Author Topic: Support_Jeep & skis  (Read 1230 times)

I was tinkering a bit earlier with scripting (and I'm still learning).  I was attempting to create a vehicle that was half "skis" and half "jeep."  In other words, I was trying to create a sled that acted one, but was powered.  It's actually a dog sled (like the covered wagon, but a sled), and i just wanted to know if this was possible or not.  If so, how would you do it?  Don't worry about me releasing, this is for the survival RP mod only, and I'll probably have AGlassOfMilk or some other coder like Tom do the coding.

I don't know why this would be for Survival RP but I could see it being useful. Maybe look at the sled?

You could have it's power set low, but I don't usually work with vehicles/weapons too much. So I wouldn't know exactly how to set it. I could learn though. It's not that hard.

I don't know why this would be for Survival RP but I could see it being useful. Maybe look at the sled?



bump, is it possible?

What do you mean exactly? What do you want the sleigh to do?

I want it to slide like the skis and the toboggan, but be powered.  What I mean by slide is that if (for instance) you cut the throttle while going perpendicular to a slope, you will slide down the slope, even though you are not facing downwards.

I'm pretty sure it's possible to have power (As the ski's have a little power to get you going) and have it slide. I'd have to look at the ski's code, I'm pretty sure it's possible.

I want it to slide like the skis and the toboggan, but be powered.  What I mean by slide is that if (for instance) you cut the throttle while going perpendicular to a slope, you will slide down the slope, even though you are not facing downwards.

Code: [Select]
// jeep_tire.cs

datablock WheeledVehicleTire(jeepTire)
{
   // Tires act as springs and generate lateral and longitudinal
   // forces to move the vehicle. These distortion/spring forces
   // are what convert wheel angular velocity into forces that
   // act on the rigid body.
   shapeFile = "./jeeptire.dts";

mass = 10;
    radius = 1;
    staticFriction = 5; //<< determines how much resistance the tires provide when wheels have Traction with the ground
   kineticFriction = 5; //<< determines how much resistance the tires provide when wheels do not have Traction with the ground
   restitution = 0.5;

   // Spring that generates lateral tire forces
   lateralForce = 18000;
   lateralDamping = 4000;
   lateralRelaxation = 0.01;

   // Spring that generates longitudinal tire forces
   longitudinalForce = 14000;
   longitudinalDamping = 2000;
   longitudinalRelaxation = 0.01;
};

There's also a bunch of lines in the wheeledVehicleData datablock which you'd be interested in, as well as a few other things.

You'd also want to use setWheelPowered(wheelNumber,isPowered) and setWheelSteering(wheelNumber,steerAngle). You can find examples of these in the Tank script.

For kicks you could try making the dogs in front as a Wheel object for the sleigh and make it the only steering/powered wheel on the vehicle, with 2 other invisible wheels in the back of the sleigh that do nothing but slide around. Who knows it could work, or the dogs could just flip around like crazy.

The way I have it right now is a really bad, experimental cross between snatches of toboggan code (edited) and Covered wagon code (also edited).  This is why I will NOT release this, it is just horrible.  I have it set up right now with the sled having 4 "nothingtires" and three "dogtires" (similar to the covered wagon). 

Here is the tire code.  Feel free to rip on me how much it sucks, because it is basically pieces of code modified and spliced in with other pieces of code.  Basically, a huge mess.
Code: [Select]
function dogsledVehicle::onAdd(%this,%obj)
{

parent::onadd(%this,%obj);
%obj.mountImage(DogImage,1);
%obj.mountImage(Dog2Image,2);
%obj.mountImage(Dog3Image,2);

%obj.mountable = true;


//mount the nothing tire, the Dog tire and ski spring
%obj.setWheelTire(0, nothingtire);
%obj.setWheelTire(1, nothingtire);
%obj.setWheelTire(2, nothingtire);
%obj.setWheelTire(3, nothingtire);
%obj.setWheelTire(4, dogtire);
%obj.setWheelTire(5, dogtire);
%obj.setWheelTire(6, dogtire);

%obj.setWheelSpring(0, skiSpring);
%obj.setWheelSpring(1, skiSpring);
%obj.setWheelSpring(2, skiSpring);
%obj.setWheelSpring(3, skiSpring);
%obj.setWheelSpring(4, skiSpring);
%obj.setWheelSpring(5, skiSpring);
%obj.setWheelSpring(6, skiSpring);

%obj.setWheelSteering(0,0);
%obj.setWheelSteering(1,0);
%obj.setWheelSteering(2,0);
%obj.setWheelSteering(3,0);
%obj.setWheelSteering(4,0);
%obj.setWheelSteering(5,0);
%obj.setWheelSteering(6,1);

%obj.setWheelPowered(0,false);
    %obj.setWheelPowered(1,false);
%obj.setWheelPowered(2,false);
%obj.setWheelPowered(3,false);
    %obj.setWheelPowered(4,true);
%obj.setWheelPowered(5,true);
%obj.setWheelPowered(6,true);

dogspeedCheck(%obj);

%obj.Bundles0 = 1;
%obj.Frame0 = 1;
}

Mount point 6 is the leading dog, 5 is the right dog and 4 is the left dog.  The other mount points are on the sled in the normal 4 wheel mounting order.

BTW, Glass, I can give you all the .dts models if you would like to take a shot at this.

6 mount points? There should only be like 2. Don't bother taking them off, as I can turn them off in the script. I'll see which ones I like best. Send them over, I hope they have textures.

6 mount points? There should only be like 2. Don't bother taking them off, as I can turn them off in the script. I'll see which ones I like best. Send them over, I hope they have textures.

7 tires actually, 0th to 6th

Also Gadge you're making this out to be pretty complicated, but I see where you're going.

Here's an idea for the dogs, in the modeling program you're using place them far in front of the mount point (treat the mount point like the spot on the sleigh where the dog's leashes are connected per se). When you'll turn with the sleigh the dogs will pitch to one side, it will look allot like the dogs are actually leading the sleigh, you could make them powered/steerable. My only question is do the dogs spin around when the sleigh is in movement? Or can you somehow take that out through script or something?

For the remaining 4 wheels, make them super slippery and unpowered/unsteerable.

My only question is do the dogs spin around when the sleigh is in movement? Or can you somehow take that out through script or something?
Uhm, I don't know because the sled always crashed Blockland

Your idea is good, I think I will try that.

EDIT: If I had three dogs, then I would have to make another shape of dog (that's extended from the joint) for the leader because the rotation would be messed up.  Look:
          /
        o        /
==>   /     o
        o

The arrow is the sled, the "o"'s are the joints, and the "/"'s are the dogs.  see how the rotation would be messed up?  You would need something like this:
          / /
        o /
==> o /
        o

That would make extra datablocks for the extra dog shape.  Is there a way to offset a mounted wheel?
« Last Edit: July 16, 2009, 04:18:18 PM by Gadgethm »

Uhm, I don't know because the sled always crashed Blockland

Might be your collision box, are any of the wheels inside it?

Might be your collision box, are any of the wheels inside it?
The joints are not inside, but the "dogtire" extends into it...


EDIT: If I had three dogs, then I would have to make another shape of dog (that's extended from the joint) for the leader because the rotation would be messed up.  Look:
          /
        o        /
==>   /     o
        o

The arrow is the sled, the "o"'s are the joints, and the "/"'s are the dogs.  see how the rotation would be messed up?  You would need something like this:
          / /
        o /
==> o /
        o

That would make extra datablocks for the extra dog shape.  Is there a way to offset a mounted wheel?
« Last Edit: July 16, 2009, 04:25:06 PM by Gadgethm »

Look at the Covered Wagon. The Horses are just part of the model with invisible, small tires below each and a looped script to animate them if the vehicle is moving.