Making an object move with the camera?

Blitz3D Forums/Blitz3D Beginners Area/Making an object move with the camera?

dddx(Posted 2016) [#1]
Hi, I'm making a small dungeon exploring game. I made a cube for testing to see if I could make it follow the camera. It will rotate with the camera, but won't move when I move forward.

If KeyDown(30) Then TurnEntity camera,0,-1,0
If KeyDown(32) Then TurnEntity camera,0,1,0
If KeyDown(31) Then MoveEntity camera,0,0,-0.1
If KeyDown(17) Then MoveEntity camera,0,0,0.1


If KeyDown(30) Then TurnEntity testcube,0,-1,0
If KeyDown(32) Then TurnEntity testcube,0,1,0
If KeyDown(31) Then MoveEntity testcube,0,0,-0.1
If KeyDown(17) Then MoveEntity testcube,0,0,0.1

This place is my last hope for help. Hopefully someone answers ^^'


RustyKristi(Posted 2016) [#2]
Are you trying to make a 3rd person controller/view? You can just parent the camera to the cube entity and position it higher or out of the way so it will not block the view.


RemiD(Posted 2016) [#3]
Usually what i do is that i use one pivot for the "feet" to look turn left right and to move forward backward and one pivot for the "eyes" to look up down (the camera is then positionned oriented at the same position orientation than the eyes, and then kept this way (for a first person view) or moved back (for a third person view)
see : http://www.blitzbasic.com/codearcs/codearcs.php?code=2933