1306
Modification Help / Animations playing at given speeds
« on: January 04, 2015, 02:43:44 PM »
I've been working on one of the main key features of the 3rd version of the Bolt; which was to make animated spoilers go up at given X speeds. However it hasn't been going so well because of how it turns out in-game:
Most of the beginning on spawn is correct. I made it in-code to where animated spoilers will animate themselves downwards when you spawn the vehicle. The spoiler when it's down is static; as in it doesn't rotate or move. In animations when transitioning up, the braking spoiler is revealed and the static spoiler hides and vise versa when going down. The braking spoiler is self explanatory. When the vehicle brakes, then the spoiler tilts like on a regular Veyron.

Yes I do know that in the front the lights are on and the taillights are off. This was on purpose because I had to remove the brakelight animations and toggable lights function temporary due to the fact that those functions may have been causing bugs that wasn't working along with this function.
The only problem with this is that the spoiler doesn't animate itself up when you're at X speed (X=# where if speed > X -> function). It stays down for the entire time and never animates up.
NightHawk, why can't you just hide those nodes using code instead of animations?
Mostly because CVS reasons. If I were to hideNode(Spoiler_A_D); (that's the static spoiler), when I select a different spoiler, or just click the wind spoiler again, I'm sure that that node that was just hidden will re-appear. That's why I use animations instead to hide those nodes to the original part for an advantage. I've done this before.
Here's the animations in the node editor. The problem for one thing that I've confirmed it's not the problem is animation order, but here's the order of animations for now:

If you can't see the markers, they're root:start, root:end, 164S-UP:start, 164S-UP:end, 164S-DOWN:start, and 164S-DOWN:end.
And here's the animation export settings all set up properly.

Here's the vehicle's code at this moment. I have modified it a bunch of times after experimenting with it and implementing options users have posted in this thread.
Bolt.cs
Code for importing animations.
Basically from what I've said, I need help with this coding to where this happens:
X = already done and working thanks to me and you guys!
Most of the beginning on spawn is correct. I made it in-code to where animated spoilers will animate themselves downwards when you spawn the vehicle. The spoiler when it's down is static; as in it doesn't rotate or move. In animations when transitioning up, the braking spoiler is revealed and the static spoiler hides and vise versa when going down. The braking spoiler is self explanatory. When the vehicle brakes, then the spoiler tilts like on a regular Veyron.

Yes I do know that in the front the lights are on and the taillights are off. This was on purpose because I had to remove the brakelight animations and toggable lights function temporary due to the fact that those functions may have been causing bugs that wasn't working along with this function.
The only problem with this is that the spoiler doesn't animate itself up when you're at X speed (X=# where if speed > X -> function). It stays down for the entire time and never animates up.
NightHawk, why can't you just hide those nodes using code instead of animations?
Mostly because CVS reasons. If I were to hideNode(Spoiler_A_D); (that's the static spoiler), when I select a different spoiler, or just click the wind spoiler again, I'm sure that that node that was just hidden will re-appear. That's why I use animations instead to hide those nodes to the original part for an advantage. I've done this before.
Here's the animations in the node editor. The problem for one thing that I've confirmed it's not the problem is animation order, but here's the order of animations for now:

If you can't see the markers, they're root:start, root:end, 164S-UP:start, 164S-UP:end, 164S-DOWN:start, and 164S-DOWN:end.
And here's the animation export settings all set up properly.

Here's the vehicle's code at this moment. I have modified it a bunch of times after experimenting with it and implementing options users have posted in this thread.
Bolt.cs
Code: [Select]
datablock TSShapeConstructor(Bolt_164_DTS)
{
baseShape = "./Bolt 164.dts";
sequence0 = "./root.dsq root";
sequence1 = "./164SUP.dsq UP";
sequence2 = "./164SDOWN.dsq DOWN";
};
Code for importing animations.
Code: [Select]
function BoltVehicle::onAdd(%this,%obj)
{
Parent::onAdd(%this,%obj);
%obj.hideNode(lhand);
%obj.hideNode(rhand);
%obj.hideNode(lhook);
%obj.hideNode(rhook);
%obj.playThread(0,DOWN);
%obj.schedule(0,garageDefault);
}
function wheeledVehicle::BoltSpeedCheck(%this, %obj)
{
if(!isObject(%obj))
return;
%vehicle = %obj;
%speed = vectorLen(%obj.getVelocity());
if(!%vehicle.oldSpeed)
%vehicle.oldSpeed = %speed;
//Braking is not working currently
//if(%vehicle.oldSpeed)
//{
//if((%vehicle.oldSpeed - %speed) > 2) //Braking rate of speed in 500MS
//%applyBrakes = true;
//if(%speed < 1)
//%applyBrakes = false;
//}
if(%speed < 0) //Keeps throwing random negative numbers when Aero is at dead stop
%speed = 0;
%vehicle.oldSpeed = %speed;
//commandtoclient(%vehicle.getControllingClient(),'bottomprint', mFloor(%speed * 2) @"<color:FFFF00>BPS", 1);
//We use else if's so that it will find a true statement then skip the rest
if(%speed < 2) {
%vehicle.playThread(0,DOWN);
}
else if(%speed > 65) {
%vehicle.playThread(0,UP);
}
//if(%applyBrakes)
//%vehicle.playAudio(1, AeroDrift);
//if(!%applyBrakes)
//%vehicle.stopAudio(1);
schedule(500,0,"BoltSpeedCheck",%this,%obj);
}
Functions for the Bolt. The first function hides the nodes for the hands (Hands On Vehicle Reasons) and then plays the down spoiler animation. The second function is where the problem somewhere in code is.Basically from what I've said, I need help with this coding to where this happens:
X = already done and working thanks to me and you guys!
- When spawned, the spoiler goes down [X]
- At the given speed, the spoiler animates its way up, and hides the static spoiler. We can now have the option to see the brake animations while braking.[ ]
- While the speed is greater than the starting given speed, we're able to use the wind brake. [ ]
- When we've braked all the way to 0BLMPH, the spoiler goes down hiding the brake spoiler and showing the static spoiler, and braking animations on the brake spoiler are not visible. [ ]





