please help about collisions problem
Blitz3D Forums/Blitz3D Programming/please help about collisions problem
| ||
i want to do this... http://www.imgpaste.net/image/KD8pw but when i did there are number of times there in the 3d model an the collision detector separate.. specially when colliding to some thing please tell me how you'll do it my way is 1)create a pivot 2)load the 3d model( character or level) and parent to pivot (i use the pivot for controlling the movement of the model(position,rotation) 3)create a collision sphere , parent it to the 3dmodel position it to cover the whole model assign entityradius and entitybox to it 4)make collision sphere alpha=0.5( for debugging) what am i doing wrong? |
| ||
What you probably experience is due to the pivot position and the local relative position of geometry of the player model or local relative position of the collision radius are becoming separated due to collisions. If the collision response is set to STOP, then any collision between that entiy and the collision responder will result in further movement halted REGARDLESS IF THE PARENT/CHILD relationship of the collision entity. I hope this makes sense, I find it easier to visualise than describe. Anyway, a solution may be to reposition children relative to their parents after they are involved in collisions. This demonstration may highlight the situation, if it's at all related to the problem you experience: Graphics3D 800,600,32 SetBuffer BackBuffer() AmbientLight 128,128,128 Global SUN=CreateLight() MoveEntity SUN,-5,10,-1 Global CAM=CreateCamera() MoveEntity CAM,0,0,-15 Global Parent=CreateSphere(16) PointEntity SUN,Parent Global ChildA=CreateSphere(16) Global ChildB=CreateSphere(16) Global WALL=CreateCube() ScaleMesh Parent,2,2,2 ScaleMesh ChildA,0.2,0.2,0.2 ScaleMesh ChildB,0.2,0.2,0.2 EntityColor Parent,0,255,0 EntityColor ChildA,255,0,0 EntityColor ChildB,0,0,255 EntityAlpha ChildA,0.75 EntityAlpha ChildB,0.75 EntityAlpha Parent,0.1667 EntityFX Parent,16 PositionEntity ChildA,2,0.2,0,True PositionEntity ChildB,0,2,0,True EntityParent ChildA,Parent,True EntityParent ChildB,Parent,True PositionEntity Parent,-5,1,0,True EntityRadius Parent,2,2 EntityRadius ChildA,0.2,0.2 EntityRadius ChildB,0.2,0.2 PositionEntity WALL,5,0,0,True Const COLTYPE_CHILD=1 Const COLTYPE_WALL=2 EntityType ChildA,COLTYPE_CHILD EntityType ChildB,COLTYPE_CHILD EntityType WALL,COLTYPE_WALL ScaleMesh WALL,3,3,3 Collisions COLTYPE_CHILD,COLTYPE_WALL,2,2 While Not KeyDown(1) TranslateEntity Parent,KeyDown(57)*0.1,0,0,True ;UNCOMMENT THIS LINE TO SEE THE DIFFERENCE ;RePositionChildren TurnEntity Parent,0.5,0.5,0,True UpdateWorld RenderWorld Text 0,0,"Press Spacebar to move sphere" Flip Wend Function RePositionChildren() PositionEntity ChildA,2,0.2,0,False PositionEntity ChildB,0,2,0,False End Function |
| ||
Only set collisions for your collision objects and position your visual object accordingly. Easy. |
| ||
Matty, If I am correct, then I think the problem experienced is because: 1)create a pivot 2)load the 3d model( character or level) and parent to pivot (i use the pivot for controlling the movement of the model(position,rotation) 3)create a collision sphere , parent it to the 3dmodel position it to cover the whole model assign entityradius and entitybox to it 4)make collision sphere alpha=0.5( for debugging) The PIVOT does not react to collisions, only the object mesh. Howewver, this will still respond to movement. Tehrefore, your suggestion will not helkp, since the pivot will become increasingly spearated from teh child (player model) if that model continues to collide with objects. Therefore, it is necessary to establish or reestabliosh the relevant local offset position between the pivot and the player model (typically 0,0,0) after the collision. |
| ||
Some others approaches to manage colliders, collidables, collisions for turning moving characters and vehicles : http://www.blitzbasic.com/Community/posts.php?topic=106251 (#19 and #20) |