Sign in to follow this  
m_cio

physx beginner: keep camera position constant relative to an object

Recommended Posts

nvidia physx: i have an "actor" and the camera. i get the "actor" position: Nxvec3 = actorPos; actorPos = actor->getGlobalPosition() ..... and set the position of the camera on: gCameraPos = actorPos + NxVec3(0,0,-2); ..... but this position remain only on first frame. How i make the camera keep ALL THE time this position relative to the "actor"

Share this post


Link to post
Share on other sites
this is what i ask..
how i update the camera position on every frame to "actor" position (or other moving actor)...

i mean.. i need for some simple lines of codes examples which could be (for advanced ones) easy or obvious...
i am to level were i experience put some objects on scene on some coord, move ahead , move back..., change settings, change functions, arguments, update camera coordonates after diferent actors...etc ..hundreds of things like this...

Share this post


Link to post
Share on other sites
i don't know...it is imposibe ?
i use to work with havok in shockwave and the nine words of code for this , in lingo, was:

on enterframe me
cam.worldposition=object.worldposition
end

..and was one of the first thing which you learn on EVERY tutorial from net ...
because was one of the essential things you should work with in characters scene buildings....: the "attach" camera from a moving actor.
it is so hard in nvidia c++ physx to do this?
or imposible...?
so that NOBODY could give me a minimal sugestion.....

Share this post


Link to post
Share on other sites
m_cio, Zahlman gave great advice. If that code works for one frame, there is no reason why it wouldn't work for every frame. You need to make sure that the code is executed every single frame.

If you are a making a game, you probably have some sort of game loop. Put this code in the game loop (ideally in some abstracted way to work with any actor you want to attach the camera to).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this