Page 1 of 1

Pawn as a Vehicle

Posted: Wed Apr 23, 2008 10:33 pm
by creekmonkey
Is it possible to make a pawn a vehicle that you can actually ride on?

I have a pawn that moves from point to point. I attached a StaticMesh entity to it, but when the player collides with it the pawn stops moving. Is there a thread or tutorial that would point me in the right direction? I have searched the forum but cant seem to find anything that will help?

Re: Pawn as a Vehicle

Posted: Fri Apr 25, 2008 7:50 am
by metal_head
there's the gen1car.s script,which can be used for a mountable vehicle

Re: Pawn as a Vehicle

Posted: Fri Apr 25, 2008 2:38 pm
by vrageprogrammer
Which doesn't work.

Re: Pawn as a Vehicle

Posted: Fri Apr 25, 2008 8:36 pm
by creekmonkey
I am able to get the generic car script to work. But its not exactly what I need. I need a vehicle similar to a train that moves along a defined path, with the player onboard always facing the front of the train.

Need
1 to mount the vehicle
2 vehicle move along defined path
3 Player and camera to rotate with vehicle

I have been able attach a camera to the vehicle and move it from script point to script point. But the camera does not rotate with pawn, any suggestions why?

Re: Pawn as a Vehicle

Posted: Sat Apr 26, 2008 8:49 pm
by Graywolf
How are you attaching the camera?

Re: Pawn as a Vehicle

Posted: Sun Apr 27, 2008 12:28 am
by creekmonkey
I have used

AttachCamera();
and
AttachCameraToBone();

both with the same result. Camera attaches but when pawn rotates the camera either keeps its original rotation and doesnt rotate at all, or sometimes it will rotate a little, maybe 45 degrees but in the wrong direction.

I have also tried adding
self.ideal_yaw=self.player_yaw;
ChangeYaw();

with no visible results.

Re: Pawn as a Vehicle

Posted: Sun Apr 27, 2008 2:28 pm
by Danimita92
I think to do that last thing you've got to equalize the player's rotation to the pawn's rotation with
PlayerMatchAngles(char *szEntityName );

Re: Pawn as a Vehicle

Posted: Sun Apr 27, 2008 10:08 pm
by Graywolf
Since you're attaching the camera, I'm assuming this is in third-person...

I don't have have my docs handy(I'm at the library at the moment.) so you'll have to look up the specific paramaters, but...

I'd approach that like this:

1. Create a dummy pawn, turn off it's collision and rendering, and attach a fixed camera to it.
2. Do an AddTriggerOrder to check a trigger for the player boarding the vehicle(This trigger could also switch the camera.).
3. When the trigger is tripped, have the pawn drop to low level, and use PositionToPlayer (I think that's the command, please don't hate me if I'm wrong...), and set the offsets and match angles flag for what you need.

But, that's just me... And 10-to-1, that's probably the hard way. I have a bad habit of finding those. I hope this helps.

Re: Pawn as a Vehicle

Posted: Mon Apr 28, 2008 2:29 am
by creekmonkey
Well when i use the AttachCamera() command it appears as first person with the weapon showing. It seemed the actor i used for the pawn, created in milkshape was the problem. I made a new actor, a simple box for testing and the camera rotation worked.

Graywolf's approach sounds promising, and would probably give more control. Ill have to experiment and figure out the exact commands and see where it leads.

I also thought about a moving platform, but it seems the moving platform has limitations as to how far it would travel.

Re: Pawn as a Vehicle

Posted: Mon Apr 28, 2008 6:52 am
by darksmaster923
you have to have self.yaw_speed = 10000;

Re: Pawn as a Vehicle

Posted: Fri Mar 13, 2009 2:12 pm
by blutwurstchen
I am trying to do something similar with an enclosed vehicle, that starts moving automatically along a fixed path once a player gets in.

The vehicle will be animated (its a horse-drawn carriage), so is it possible for this to be a pawn?

During the time it is moving, the character should be free to move around, but not get out. I would like the controls to be via conversation (with the driver). How should I start something like this?