Moving physical object as spatial?

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)) ;
	

	
}

In the code you posted you don’t move the object at all so that could be the issue…

Ya sorry 2 sec, am editing xD Press the enter too soon

Edit : So here it is, why does the moving don’t affect the physical space?

You’re moving the spatial and not the physics object but with physics the physics object defines the location (it moves the spatial so it renders any spatial movement you do invalid). You could set the control to kinematic mode to have the physics object move with the spatial.

1 Like

O wow, I felt dumb now xD Pretty sure I tested it, but probably not the right way.

Thanks :stuck_out_tongue: