Camera mounting without rotation and tilemap collisons
by Ves · in Torque X 2D · 11/17/2007 (9:41 am) · 2 replies
Does anyone know if it is possible to mount a camera and have only the position component change with the mountee, not the rotation? In this case I am mounting a camera to a car and I don't want it rotate everytime the car does. I tried just manually copying the cars position to the camera's position in my car's input component but that gives an odd camera cathup behavior (car moves then about tenth of a second later the camera moves and it is very jumpy). The movement when the camera is mounted is very smooth which is the effect I am looking for. Any ideas? I deally I would want to copy the car's position right after the physics calculations are done (since the input component just changes velocities, angular velocities, etc) but before rendering starts. It would be more ideal if the mount system allowed me to specify a flag to ignore mountee rotation.
Also I have run into an issue (bug possibly) where the collision polygon doesn't seem to function properly when you flipx or flipy. Inside TBX the collision box properly flips graphically but when running the game any and all objects will collide with the collision poly based on the original poly position and orientation (ie in game collsion calculation seem to ignore flipx and flipy on a individual tile map).
This is a good engine and its such a relief to be working with C#. I can't wait for Torque X 3D (I have been working with TGEA for the last 6-8 months)!!
Ves
Also I have run into an issue (bug possibly) where the collision polygon doesn't seem to function properly when you flipx or flipy. Inside TBX the collision box properly flips graphically but when running the game any and all objects will collide with the collision poly based on the original poly position and orientation (ie in game collsion calculation seem to ignore flipx and flipy on a individual tile map).
This is a good engine and its such a relief to be working with C#. I can't wait for Torque X 3D (I have been working with TGEA for the last 6-8 months)!!
Ves
#2
Thanks, that was perfect. I looked through documentation on T2DSceneCamera at first and didn't see that property before but sure enough it's there now. My wife's voice rings in the back of my head with regards to my inability to find things that are staring me right in the face :).
I had to move the setting of that property to after the mount call but it worked perfectly once I did that (apprently when you call mount you reset that property). So it's
Thanks for the quick response...
Ves
11/17/2007 (12:06 pm)
John,Thanks, that was perfect. I looked through documentation on T2DSceneCamera at first and didn't see that property before but sure enough it's there now. My wife's voice rings in the back of my head with regards to my inability to find things that are staring me right in the face :).
I had to move the setting of that property to after the mount call but it worked perfectly once I did that (apprently when you call mount you reset that property). So it's
_camera.Mount(_player, "", false);
//ignore the rotation
_camera.TrackMountRotation = false;Thanks for the quick response...
Ves
Associate John Kanalakis
EnvyGames
protected override void BeginRun() { base.BeginRun(); SceneLoader.Load(@"data\levels\levelData.txscene"); T2DAnimatedSprite _player = TorqueObjectDatabase.Instance.FindObject<T2DAnimatedSprite>("player"); //get a hold of the camera object T2DSceneObject _camera = TorqueObjectDatabase.Instance.FindObject<T2DSceneCamera>("SceneCamera"); //ignore the rotation _camera.TrackMountRotation = false; _camera.Mount(_player, "", false); }As for the collision problem, I haven't tried that yet. I'm pretty sure that the collision polygon points are not flipped with the image, mainly because the collision is handled by a separate component.
John K.