Player moves forward when touching terrain
by Amr Bekhit · in Torque Game Engine · 01/08/2007 (1:14 pm) · 7 replies
Hello all,
In my quest to implement ships in Torque, I've been trying to implelement a ship as a Player object. The only problem is that it seems that Player objects can only move forwards if they are touching the terrain and so this poses a problem for me when the ship is in water. I thought that if I could disable the test which checks to see if the player is touching the terrain before moving, then I could get my ship to work. I've looked through player.cc but I was unable to find such a test (probably due to my inexperience with the code). I was wondering if someone could point me to where this test is?
Thanks.
--Amr
In my quest to implement ships in Torque, I've been trying to implelement a ship as a Player object. The only problem is that it seems that Player objects can only move forwards if they are touching the terrain and so this poses a problem for me when the ship is in water. I thought that if I could disable the test which checks to see if the player is touching the terrain before moving, then I could get my ship to work. I've looked through player.cc but I was unable to find such a test (probably due to my inexperience with the code). I was wondering if someone could point me to where this test is?
Thanks.
--Amr
#2
It was just a quick glance at the code. Good luck!!
01/08/2007 (1:32 pm)
If you just want to quickly test your theory... you may be able to change player.cc line 1558 from 'mContactTimer++;' to mContactTimer = 0;It was just a quick glance at the code. Good luck!!
#3
@Affectworks: Thanks's for the tip - unfortunately it doesn't seem to work - the player just sits still and doesn't move forward. However, I did do a search for mContactTimer and have come up with this thread which contains code to make a player fly. I'm going to give that a go.
--Amr
01/08/2007 (2:10 pm)
@Surge: For my purposes, I won't be using the ship as a vehicle per se, as the ship will be the actual player itself, the only difference between it and the stock Player object is that the ship can move on water (either really floating on the water or just moving at a constant height). Also, the Player object has a very simple control style, quite unlike the ones of the vehicles.@Affectworks: Thanks's for the tip - unfortunately it doesn't seem to work - the player just sits still and doesn't move forward. However, I did do a search for mContactTimer and have come up with this thread which contains code to make a player fly. I'm going to give that a go.
--Amr
#4
Sounds to me thats roughtly what you want and that allows moving on the surface of the water? :)
Regards
Graham
01/08/2007 (2:37 pm)
Why not play with one of the swimming resources?Sounds to me thats roughtly what you want and that allows moving on the surface of the water? :)
Regards
Graham
#5
Thanks
--Amr
01/09/2007 (9:53 am)
Hmm good point Graham, thanks for the info. I will have a search for them.Thanks
--Amr
#6
01/09/2007 (10:39 am)
I was thinking more of the hoover vehicle, specifically. Good Luck
#7
--Amr
01/09/2007 (10:41 am)
The HoverVehicle (I assume you meant hover, not hoover!) was in fact my first port of call when implementing the ship, but the problem is that the control syle and physics for the HoverVehicle isn't very suitable for a ship and that's why I've been looking at using the player class.--Amr
Torque Owner Surge
MDNAMEDIA
The player code is not the same as something you would code for a ship.