Camera control & transformations - Please help

Blitz3D Forums/Blitz3D Beginners Area/Camera control & transformations - Please help

Festay(Posted 2007) [#1]
I have just purchased the blitz3dSDK and i am using it in conjunction with Blitzmax. I am new to 3d game programming so as a first project i decided to setup a simple game framework to learn some of the commands.
The idea is this - a level that the player can move about in. nothing complicated, i just want to be able to move the "player" and the camera around. so far so simple!

I have loaded a B3d map created in Maplet and placed a cube in the map (The cube represents the player). I have then created a pivot entity and a camera entity. The pivot is located in the centre of the cube and also parented to the cube.
The camera is then set behind the cube and then parented to the pivot.

the control system i am trying to implement is one similar to Mario 64 or Soul Reaver. I.E. the camera can be rotated around the player and the movement keys move the player relative to the camera.
Basically the up key moves the player "into the screen", the down key moves the player "Towards the camera" and the left and right will make the player strafe left and right.

I have managed to implement the basic movement of the cube entity - if i press up the entity moves "into" the screen etc.

The problems start when i try and rotate the camera. i can rotate the camera around the cube but i cannot figure out how to then move the player entity relative to the new camera position.
I have done numerous searches and have come to the conclusion that i need to transform the entity positions using the TForm commands. Could anyone please explain how to use these commands to achieve the results i want? i am not looking for some code to copy into my program. i am really looking for some detailed descriptions of what these commands do and how they work - that way i can have a go at implementing the system myself and learn something. I have read various descriptions of these functions but i still dont "get" them. any help would be greatly appreciated.

Sorry for the length of the post, however i thought it best to adequately describe my problem in order to get the best responses.

Thanks.


Stevie G(Posted 2007) [#2]
See code here ...

http://www.blitzbasic.com/Community/posts.php?topic=69983#783464

Stevie


Festay(Posted 2007) [#3]
Thanks Stevie.

I had actually already viewed this post but at the time things didn't "click into place" for me.
i have implemented the code into my project and i am playing around with different values to see what effects the changes have.

I'll continue playing around to see if can understand it sufficiently to suit my needs.

Thank you for the quick response.

regards