Linepick with Separate Capsule Mesh

Blitz3D Forums/Blitz3D Programming/Linepick with Separate Capsule Mesh

RustyKristi(Posted 2016) [#1]
I would like to know how I would go about this. My models are not good for line picking so I plan to use capsule meshes to handle linepicking.

Do I just entityalpha the capsule and parent it to the actual mesh or pivot and it should work?


Bobysait(Posted 2016) [#2]
You can, but you can also hide them before renderworld instead of using alpha (it will drastically lower the fps)
Just show them for picking


RustyKristi(Posted 2016) [#3]
Thanks Bobysait

So..

ShowEntity capsule
UpdateWorld
...
HideEntity capsule
...
RenderWorld


Is this ok?


RemiD(Posted 2016) [#4]
With ellipsoid colliders and collidables this will probably not work (or inconsistently) (because whatever the order of your code we don't know what goes behind the scene of updateworld)
see : http://www.blitzbasic.com/Community/posts.php?topic=98459

But entityalpha collidable,0 will work, i suggest that


With linepicks and pickables this will work if you do it this way (because linepicks is separate from updateworld) :
showentity pickable
linepick
if( pickedentity <> 0)
;blahblah
endif
hideentity pickable

entityalpha pickable,0 will also work, i suggest that


RustyKristi(Posted 2016) [#5]
Thanks RemiD. Can you provide a very basic sample demonstrating this? sorry linepicking or collision is still one of my weak points here :S


RemiD(Posted 2016) [#6]
Yes :
with dim arrays list : http://www.blitzbasic.com/codearcs/codearcs.php?code=3094
with customtype list : http://www.blitzbasic.com/codearcs/codearcs.php?code=3095
also : http://www.blitzbasic.com/codearcs/codearcs.php?code=3282

search for "entitypickmode" and take a look at the code between entitypickmode(thing,2) and entitypickmode(thing,0)


RemiD(Posted 2016) [#7]
It would be good to have a better collisions system (low details shape->low details shape) with a step by step update (per collider) to prevent one turning moving to go through another turning moving, and not dependent on the meaningless function updateworld() (that most coders like to always put in their code even when there is no need for it (just trolling a little))

updateworld() would then be used only to update joints/bones/skinnedvertices

It is on my todo list.


RustyKristi(Posted 2016) [#8]
thanks. I was looking for a more really basic example and the actual mesh on a collision mesh using linepick.


RemiD(Posted 2016) [#9]
Well, use your brain/mind a little... There is all you need in these examples.


RustyKristi(Posted 2016) [#10]
Don't worry, if you cannot provide a basic example. sorry to bother.

The demo you provide does not provide a mesh collision within a mesh, that's why I'm asking. It's related to linepicking which is a broad topic, but not specific.


RemiD(Posted 2016) [#11]
You don't bother me, but it is appreciated if you demonstrate that you have made some efforts on your side.

The examples in the first and second links demonstrate how to use linepicks and pickables anywhere in your mainloop (you don't need updateworld)
and the example in the third link demonstrate how to do capsule->shape collisions detection and repositionning using linepicks and pickables (the pickables can be any low details closed shape)


Please rephrase what you want to achieve, because i think that you are talking about something else than what you asked in your first post.


Bobysait(Posted 2016) [#12]
@RemiD: Hide/show the entity, don't use alpha for debug mesh
There is no reason to use alpha if the entity is not supposed to be rendered (that's why we hide it before the renderworld)

(and by the way, if the alpha is not 0.0, it will be drawn in the alphalist, which takes more time to render)


(because whatever the order of your code we don't know what goes behind the scene of updateworld)


hey, we have access to the source, the updateworld is fully readable and pretty clear.
If you have a look in "blitz3d/world.cpp", you 'll find the source for both render and update
render generates a list of "visibles" entities while update generates a list of "enabled" entities.
-> https://github.com/blitz-research/blitz3d/blob/master/blitz3d/world.cpp


ps : For collisions, what you're looking for would be solved with a verlet integration.


RemiD(Posted 2016) [#13]
@Bobysait>>except the source code in c++ looks like chineese to me (and probably to many users of Blitz3d)


RustyKristi(Posted 2016) [#14]
thanks. I will just try the updateworld before render, it seems simple and a possible solution.


RemiD(Posted 2016) [#15]

(and by the way, if the alpha is not 0.0, it will be drawn in the alphalist, which takes more time to render)


i suggested to set the alpha of collidables/pickables to 0, and it seems to work well and to be fast enough...
The 3rd example that i linked to has the pickables with a alpha higher than 0 just for debug purposes...