Author Topic: Making a vehicle with a chase cam  (Read 2262 times)

I'm working on my snowmobile vehicle, and i want to give it a chase cam, but i don't know how, 8 seems to work best, from what i could tell when i manually typed it into the console

I want to make it so that when a player gets on the vehicle, the chase cam activates, and then deactivates when they get off, something like this
Code: [Select]
function armor::onMount(%this,%obj)
{
   %serverConnection.chasecam("8");
   Parent::onMount(%this,%obj)
}
function armor::onUnMount(%this,%obj)
{
   %serverConnection.chasecam("0");
   Parent::onUnMount(%this,%obj)
}
...only working, and looks like it was made by someone who knows what they're doing

%serverConnection is not defined. Change the %serverConnection to %obj.client.

%serverConnection is not defined. Change the %serverConnection to %obj.client.
My snowmobile disappeared off the list and executing it gives this error
Quote
   protectPassengersRadius = true;  //protect passengers from radius damage (explosions) ?
   protectPassengersDirect = false; //protect passengers from direct damage (bullets) ?
};

function armor::onMount(%this,%obj)
{
   %obj.client.chasecam("8");
   Parent::onMount(%this,%obj)
}##
##
function armor::onUnMount(%this,%obj)
{
   %obj.client.chasecam("0");
   Parent::onUnMount(%this,%obj)
}
Not exactly helpful, but i'm certain it's something i've done wrong, like not knowing how to implement %obj.client with the chasecam

Out of curiosity, i tried using %client.chasecam and replacing %obj in the onMount/onUnMount parameters into %client, but that ended the same way :cookieMonster:

You're missing two ; somewhere, look closely.

You're missing two ; somewhere, look closely.
After the }'s, right?
Quote
}##;##

Oh dear


So now it works, but the player is no longer sitting, he randomly rotates on mounting to the vehicle and is no longer affacted by the look up/down limits

Quote
4:00 PM - Alphadin.EXE -EC: it's becuase he's no longer locked in with the regular camera.
4:01 PM - Masterlegodude: Because of the chase cam?
4:01 PM - Alphadin.EXE -EC: pretty positive yeah
4:01 PM - Masterlegodude: I don't  think so, i had this happen long before i tried implementing the chase cam
4:01 PM - Masterlegodude: I was just trying to get the hands to be raised
4:01 PM - Masterlegodude: By using playThread
4:02 PM - Masterlegodude: And he would stop sitting and be all broke

So it's probably not the chase cam

did you package it?
oh also your missing some arguments onMount

Code: [Select]
package ChaseCamVehicle
{
   function armor::onMount(%this,%obj,%a,%b)
   {
      %obj.client.chasecam("8");
      Parent::onMount(%this,%obj,%a,%b);
   }
   function armor::onUnMount(%this,%obj)
   {
      %obj.client.chasecam("0");
      Parent::onUnMount(%this,%obj);
   }
};
ActivatePackage(ChaseCamVehicle);
« Last Edit: April 21, 2013, 04:48:18 PM by swollow »

did you package it?
oh also your missing some arguments onMount
Like what? I don't know much about arguments

Also, it's not packaged, but what does packaging do that makes such a difference?

type Trace(1);
do something that involves the function
type Trace(0);

find the part in the console where that function occurs
check how many arguments there are, you might need to do some testing to figure them out
if it doesn't matter just name them stuff like %a and %b

I fixed the code for you and edited it into my last post

if you don't package default functions they stop working

also its a good idea to make sure that the client exists and its not a bot dismounting/mounting

Why has adding this script made the tire emitter stop working? Torque is so weird

also its a good idea to make sure that the client exists and its not a bot dismounting/mounting
How does one do such a thing?

Why has adding this script made the tire emitter stop working? Torque is so weird
How does one do such a thing?

Very carefully.

You can use the isObject(%potentialObject); function and %object.getClassName(); method to do such a thing.

Also, just making sure, the chase cam kinda jumps around spastically at times, i assume there's no way to actually fix that because of how the chase cam itself works, right?

Very carefully.

You can use the isObject(%potentialObject); function and %object.getClassName(); method to do such a thing.
Also again, well i'm thankful for all the help, i honestly don't know how to do some of these things on my own

Garage Games was the only place i knew there was documentation on what things do what and what arguments, variables and scripts exist, but when they made Torque3D and such, they threw everything relating to older Torque engines out the window, so i don't know of other places that i can look up this stuff

Edit:
Well, the documentation that Garage Games has does have a couple of helpful pages on these things, but that's about it
« Last Edit: April 22, 2013, 04:45:22 PM by Masterlegodude »

I discovered an issue, there's a chase cam and my character's hands raise with every other vehicle

Could this be because of either the parent parameter or the package, or both?

Would i have to make it do a check to see if it's the snowmobile vehicles and if it's anything else to not do anything?

Edit: Goodness gracious, i've successfully added in the check! What the snowmobiles do no longer carries over to other vehicles!

I feel so happy that i've done something right

This is the new package
http://pastebin.com/raw.php?i=MR5qG26d

Nothing look wrong there, yes?

Alright, this topic's done for now, thanks for all the help :D
« Last Edit: April 22, 2013, 06:32:20 PM by Masterlegodude »