parent objects to rolling ball?
Blitz3D Forums/Blitz3D Programming/parent objects to rolling ball?
| ||
hey, another ball rolling question. i want whatever the ball rolls over to stick to it and rotate with it. im using the entityparent command to parent the entity to the rolling ball but each obj that sticks to it just sits there. any ideas? thanks, |
| ||
Katamari damacy anyone? |
| ||
Make sure that you are performing it correctly, I guess. Check that you are referring to the correct local or global coordinates and parenting to the correct entity. |
| ||
You're not using RotateMesh to roll the ball are you? |
| ||
What's up with all the empty replies? Anyway, to achieve this, you'll have to parent it yourself. Just knocked this up, don't blame me if it sets fire to your dog. type link field rX#,ry#,rz# field ent1,ent2 end type function entityParentPosition(entity,parent) o.link=new link o\rx=entityX(entity)-entityX(parent) o\ry=entityY(entity)-entityY(parent) o\rz=entityZ(entity)-entityZ(parent) o\ent1=entity o\ent2=parent end function function updateLinks() for l.link =each link positionEntity l\ent1,entityX(l\ent2)+l\rx,entityY(l\ent2)+l\ry,entityZ(l\ent2)+l\rz next end function With that you can manually create position only parent/child relationships for one entity at a time. entityParentPosition(Ball,Camera) then call updateLinks once per frame. |
| ||
What's up with all the dead replies? the one before was by me, some code to help the guy, lost forever..so it's a issue with the site/server it's self? Making space for bmax!? :) |
| ||
??? SpacedMan, put down the suspiciously large cigarette and step away from the computer. :) |
| ||
lol, no seriously, the reply before mine, look clearly, there's a border between the two that shouldn't be there. That's all that showed up of my reply. Check off-topic, gfx's post to robbrown(?) empty...noel's two replies..empty. Don't play with my sanity..you see it too right!? :) |
| ||
spacedman, i tried your code and it is not working for me. i am using rotatemesh for the ball. should i be doing other wise? thanks, |
| ||
tank: Use TurnEntity or RotateEntity instead. Look up all the commands in the docs and you should realize why it doesn't work with RotateMesh. ;) Spaced: Mine's the post before yours and I dont see anything you mention. However, in offtopic GFK's post has you as the last poster even though you haven't posted!?!?!? :O What skin you using? |
| ||
Yeah, 'cos I can't even see gfk's post. So I replied 'WTF' Methinks that's the work of the mods though, if they can see gfk's reply, it would have appeared to be a troll.. Skins, just changed from skn3(See off-topic)..and i can see my reply here now..but still not gfk's posts. I'm confused. Very very confused. ;p |
| ||
hi, i can't seem to get simple ball rolling to work with using turnentity or rotateentity. any help? thanks for all the help. these forums are great. |
| ||
Make sure the origin of the ball is at its center. |
| ||
if i roll my ball in a strait line its fine. but once i say aim it left backwards the actuall rolling looks all jacked up. |
| ||
With RotateEntity() you must rotate it an absolute amount ... it doesn't keep track of how much it's been rotated. TurnEntity() will turn the entity by a certain amount from it's current pitch, yaw, and roll. RotateEntity(Ball, 90, 0, 0) ... will rotate the ball to the same angle every time. TurnEntity(Ball, 90, 0, 0) will turn the entity 90 degrees from it's current pitch every time you call it. I suggest using RotateEntity() and keep track of the current pitch, yaw, and roll yourself (can't use Blitz's EntityPitch() EntityYaw() and EntityRoll() because they'll always return a value between -180 and 180. So ... If KeyDown(200) ballPitch# = ballPitch# + .1 EndIf If KeyDown(208) ballPitch# = ballPitch# - .1 EndIf RotateEntity(ball, ballPitch#, 0, 0) |