This content has been marked as final. Show 4 replies
Can't anyone help me with this, please?
I really am tearing my hair out here.
I'm actually in a similar position, and you'll probably get more response if you post this in the 3d forum, but...
Each frame I matched the camera to the position of the ball, moved it back with a translate, and then used poinAt to always look at the ball. This works well enough, unless you want the camera to always follow "behind" the ball no matter what direction your ball is going. You could also set up camera positions throught the scene, and switch to those as requested by the user, using pointAt with in each frame. I've got a question in the 3d forumn you might want to watch and see if anyone comes up with a better idea.
Thanks for your reply.
I've been trying all day to get the thing using the pointAt and it just keeps throwing up errors. I can point at objects I've created using Director/Lingo, but all the objects from the W3D file throw up errors if I try and pointAt them. Would it be too much to ask to request you put a little bit (even a couple of lines) of code together using my variable names etc. to see how it should look?
I don't have director in front of me to check the syntax, but try this:
on exitFrame me
-- x axis (RED) point left, y axis (GREEN) points towards the camera and z axis (BLUE) points up
-- Marble Movement
if keyPressed (126) then rb.applyImpulse (vector (-300, 0, 0 ))
else if keyPressed (125) then rb.applyImpulse (vector (300, 0, 0))
else if keyPressed (123) then rb.applyImpulse (vector (0, 300, 0))
else if keyPressed (124) then rb.applyImpulse (vector (0, -300, 0))
--Make camera follow ball (although rotation never changes this way)
ballTransform = m.getWorldTransform()
w.camera.transform.position = ballTransform.position
lookAtPosition = ballTransform.position
It should give you a good a start at least....