Control a HoverVehicle?
by RealDecoy Inc · in Torque 3D Professional · 03/13/2010 (7:13 am) · 4 replies
Hey, I have replaced the player with a hovervehicle, so that the player spawns initially inside a hovervehicle.
Unfortunately I can't seem to figure out how to have the player control the vehicle. Nothing I do ingame does anything, it just floats around all jittery...
I tried to find any documentation on how to control hovervehicle, and couldn't. Then I tried to find functions, or variables that might let me apply thrust, or steer... But nothing...
What am I missing? If I replace the character with a wheeledvehicle instead, it works fine. But my intended game model would work with a hovervehicle, not a wheeled vehicle.
I am hoping to use the RTS tutorial to create a topdown camera, and then programmatically feed control to the vehicle from that perspective (essentially treating it as an AIPlayer, but since one player will have direct control of a single hovervehicle, I will just map the players input to functions that feed control to the hovervehicle... Basically I want a top-down shooter, with fixed camera rotation (RTS style, up is north) but always centered on the player's vehicle. I think I can do this almost entirely in script, but I'm struggling on certain points... I do own source license, but I am trying to get a "tech demo" working without modifying source. If I can get 90% of the way there without modifying source, it gives me tons of flexibility to port to new versions of the engine or whatever during development with minimal effort.
But first I need to get the bloody vehicle to work lol...
Thanks!
Unfortunately I can't seem to figure out how to have the player control the vehicle. Nothing I do ingame does anything, it just floats around all jittery...
I tried to find any documentation on how to control hovervehicle, and couldn't. Then I tried to find functions, or variables that might let me apply thrust, or steer... But nothing...
What am I missing? If I replace the character with a wheeledvehicle instead, it works fine. But my intended game model would work with a hovervehicle, not a wheeled vehicle.
I am hoping to use the RTS tutorial to create a topdown camera, and then programmatically feed control to the vehicle from that perspective (essentially treating it as an AIPlayer, but since one player will have direct control of a single hovervehicle, I will just map the players input to functions that feed control to the hovervehicle... Basically I want a top-down shooter, with fixed camera rotation (RTS style, up is north) but always centered on the player's vehicle. I think I can do this almost entirely in script, but I'm struggling on certain points... I do own source license, but I am trying to get a "tech demo" working without modifying source. If I can get 90% of the way there without modifying source, it gives me tons of flexibility to port to new versions of the engine or whatever during development with minimal effort.
But first I need to get the bloody vehicle to work lol...
Thanks!
#2
I don't know if this is your issue, so let the professionals answer if its not.
03/13/2010 (4:20 pm)
I have never tried the hovervehicle but usually when I'm not having control over the vehicle I'm sitting in its because this code haven't been called;%client.setcontrolobject(%vehicle);
I don't know if this is your issue, so let the professionals answer if its not.
#3
Anyone know where I should look for the code that handles that?
03/13/2010 (6:21 pm)
Ok so I tweaked and tweaked and so on, and was able to get my hovervehicle controllable in first person. But when I switch the camera to be orbit mode, I loose control of the hovervehicle.Anyone know where I should look for the code that handles that?
#4
Anyway, I fixed that, but since my game is defaulted to topdown view using orbitmode (with locked turned on, so the camera angle is fixed). I have no control. If I alt-c to toggle first person on, I have full control, toggle back out to topdown, and no control... If I accelerate in first person, and toggle out, it keeps up it's momentum, however if I am spinning because I built up some turning momentum and toggle to top-down it stops spinning immediately (but keeps up it's movement momentum). I'm assuming that has to do with the locked camera angle.
Anyway, anyone have any thoughts?
03/13/2010 (6:24 pm)
Marcus: Yeah I was definately already setting the controlobject. It had to do with the datablock. Apparently with hovervehicles it's REALLY picky about the parameters in the datablock (minor changes can make the physics puke, and get the vehicle stuck, so it won't react to input).Anyway, I fixed that, but since my game is defaulted to topdown view using orbitmode (with locked turned on, so the camera angle is fixed). I have no control. If I alt-c to toggle first person on, I have full control, toggle back out to topdown, and no control... If I accelerate in first person, and toggle out, it keeps up it's momentum, however if I am spinning because I built up some turning momentum and toggle to top-down it stops spinning immediately (but keeps up it's movement momentum). I'm assuming that has to do with the locked camera angle.
Anyway, anyone have any thoughts?
Torque 3D Owner RealDecoy Inc
Perhaps it has to do with the fact that I'm riding on a groundplane? (not terrain)
Anyway, here is my datablock (copied from an example here on the forums):
datablock HoverVehicleData(Hover) { category = "Vehicles"; shapeFile = "art/shapes/vehicles/hovercraft/hovercraft.dts"; emap = true; maxDamage = 1000.0; destroyedLevel = 900.0; drag = 0.2; density = 0.3; integration = 4; // Physics integration: TickSec/Rate collisionTol = 0.3; // Collision distance tolerance contactTol = 0.2; // Contact velocity tolerance rechargeRate = 0.7; energyPerDamagePoint = 75; maxEnergy = 650; minJetEnergy = 165; jetEnergyDrain = 1.3; // Rigid Body mass = 105; bodyFriction = 0.1; bodyRestitution = 0.3; softImpactSpeed = 20; // Play SoftImpact Sound hardImpactSpeed = 28; // Play HardImpact Sound // Ground Impact Damage (uses DamageType::Ground) minImpactSpeed = 29; speedDamageScale = 0.10; // Object Impact Damage (uses DamageType::Impact) collDamageThresholdVel = 23; collDamageMultiplier = 0.030; dragForce = 1.0; // dragForce = 25 / 45.0; vertFactor = 0.8; floatingThrustFactor = 0.5; mainThrustForce = 750; reverseThrustForce = 600; strafeThrustForce = 670; turboFactor = 1.5; brakingForce = 900; brakingActivationSpeed = 30; stabLenMin = 28.50; stabLenMax = 32.50; stabSpringConstant = 38; stabDampingConstant = 28; gyroDrag = 18; // 16 //gyroForce = 50; normalForce = 30; restorativeForce = 1600; steeringForce = 1000; rollForce = 30; pitchForce = 30; };