Hello! Am trying to make a moving platform so that I can jump on them whit my character, but I felt like am missing something: confused:
How can I move my platform as I move my spatial? I am trying to set the vectors, the setLinearVelocity but it seems like nothing work like I want.
public class TA_MovingCircle_BAP extends AbstractControl
{
private float speed ;
private float rayon ;
private Spatial model ;
private float buffer = 0 ;
RigidBodyControl control ;
public TA_MovingCircle_BAP(float Speed, float rayon, float phase, Spatial Model, BulletAppState space)
{
setSpeed(Speed) ;
setRayon(rayon/10) ;
model = Model ;
model.addControl(this);
buffer = phase;
RigidBodyControl control = new RigidBodyControl(0) ;
control.setEnabled(true);
Model.addControl(control);
space.getPhysicsSpace().add(Model);
}
@Override
protected void controlRender(RenderManager arg0, ViewPort arg1)
{
}
@Override
protected void controlUpdate(float fps)
{
buffer += (Math.PI/120); //Math.abs(speed*fps*30) ;
model.move(new Vector3f(rayon*(float)Math.cos(buffer),rayon*(float)Math.sin(buffer),0)) ;
}