# Relative Camera Like Mario64

This topic is 4675 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Greetings! I was wondering are there any tutorial with mathematical functions or even better with D3DX code how to create relative camera movement like in Mario 64? I would like a 3D person view like Tomb Raider but the player should not rotate but when you say right he runs right on the screen at once regardless of the camera direction. Thank you in advance for any kind of tip.

##### Share on other sites
Hallo,

If I understand you correctly, what you're talking about is directional control, where as good ole' Lara "Truck" Croft used rotational control ;O)

If you've already got your camera stuff set up, then its more or less just a case of creating a direction vector from the pad input (or keyboard...whatever) and then rotating this by your camera's world Y rotation. So effectively making the input control relative to the camera orientation.

So which ever way the camera is facing, if you press right say, you're creating a heading vector along the X axis ideally...and then rotating this by whatever the cameras world Y is will take that vector in the X axis and turn it into a vector in the camera's X axis, or "Camera space X". Does that make sense...I tend to babble my way through explanation :op

Of course you'll have to handle orientating the character too so if they're facing "left" and you hit "right" they'll either have to snap round some way or more likely rotate about their Y axis until they're facing the new heading vector's direction. you can just interpolate their rotation over 1/4 of a second...or something, whatever looks right. Perhaps doing the rotation before you start their actual movement along the new heading. Experimentaion and tweaking is the key when you get the basics working. Mario turns very quickly which give him the fast snappy Mario feeling, which I like very much.

Sorry I've no links and I've no code in front of me at the moment that I can post, but hopefully thats given you at least an idea how you could do it

GCoder

##### Share on other sites
Thank you for the idea with the Camera Y axis! I will have to perform some tests later that evening. If anyone has some more suggestions, feel free to post!

1. 1
Rutin
32
2. 2
3. 3
4. 4
5. 5

• 13
• 9
• 9
• 9
• 14
• ### Forum Statistics

• Total Topics
633319
• Total Posts
3011346
• ### Who's Online (See full list)

There are no registered users currently online

×