Okay,.. now it makes more sense.
As i thought, you??????ve defined your switchramp function the wrong way. There are only "times" no acceleration and no heights... the switchramp function makes movings "fluid" .. "start >> acceleration to >> max speed >> decceleration to >> stop" .. i hope that makes more sense now
If you look at the following line:
_catTrans.y = c_startHeight + (float)Tools.switchRampC2(c_moveUpTime, c_maxHeight, c_moveAccelerationTime, _sumTime);
...you can see the "move up time", followed by a defined "max height", an "acceleration time" and the "summary time".
Now look at your line:
m_carTrans.y = fCarHeight + (float)Tools.switchRampC2(fMoveUp1 ,fMoveUp1 ,fUpTime, Time);
..there are only doubled time variables.
I highly recommand to play with the existing scripts, which are working already and from there with small steps further
import com.nolimitscoaster.*;
import nlvm.math3d.*;
public class HTH extends Script
{
private SceneObject m_sco;
private SceneObjectElement _car;
private Vector3f _carTrans;
private float _sumTime;
private static final float c_enterTime = 50.0f;
private static final float c_moveUpTime = 50.0f;
private static final float c_moveDownTime = 50.0f;
private static final float c_upTime = 10.0f;
private static final float c_moveAccelerationTime = 10.0f;
private static final float c_rotAccelerationTime = 10.0f;
private static final float c_startHeight = 0.0f;
private static final float c_maxHeight = 64.0f;
private static SceneObjectElement loadSOE(SceneObject sco, String name)
{
SceneObjectElement elem = sco.getElementForName(name);
if (elem == null)
{
System.err.println(name + " not found");
System.exit(-1);
}
return elem;
}
public bool onInit()
{
m_sco = sim.getSceneObjectForEntityId(getParentEntityId());
_car = loadSOE(m_sco, "CAR");
_carTrans = new Vector3f();
return true;
}
public void onNextFrame(float tick)
{
_sumTime += tick;
// Ride animation:
// Moving up
if (_sumTime < c_moveUpTime)
{
_carTrans.y = c_startHeight + (float)Tools.switchRampC2(c_moveUpTime, c_maxHeight, c_moveAccelerationTime, _sumTime);
}
// Staying up
else if (_sumTime < (c_moveUpTime + c_upTime))
{
_carTrans.y = c_startHeight + c_maxHeight;
}
// Moving down
else if (_sumTime < (c_moveUpTime + c_upTime + c_moveDownTime))
{
_carTrans.y = c_startHeight + c_maxHeight - (float)Tools.switchRampC2(c_moveDownTime, c_maxHeight, c_moveAccelerationTime, _sumTime - (c_moveUpTime + c_upTime));
}
// Waiting to enter
else
{
_carTrans.y = c_startHeight;
if (_sumTime > (c_moveUpTime + c_upTime + c_moveDownTime + c_enterTime))
{
_sumTime = 0;
}
}
_car.setTranslation(_carTrans);
}
}
I also don??????t know what you??????re planning, maybe a script with "steps" will do the trick better for your object.. but it??????s also a bit harder to start with.
I hope that helped to get you started
Nice greetings.