Skip to main content
added 27 characters in body; edited title
Source Link
Jesse Dorsey
  • 2.9k
  • 4
  • 34
  • 59

Moving How would I move an object using its velocity on a closed curve?

I want that an object follows a path, in Peggle game there are some pegs that have movement in a closed path. How can i get the same result? I guess that I can use parametric curve but I need use the velocity and not the position (x, y).

I use NAPE and I have this in my gameloop:
//circunference angle = angle + 1*(Math.PI / 180); movableBall.position.x = radius * Math.cos(angle)+ h; movableBall.position.y = radius * Math.sin(angle)+ k;

//circunference   
angle = angle + 1*(Math.PI / 180);  
movableBall.position.x = radius * Math.cos(angle)+ h;  
movableBall.position.y = radius * Math.sin(angle)+ k;

it'sIt works but I can not control the velocity, each movableBallmovableBall must have its own velocity. Besides, from docs of NAPE:"Setting the position of a body is equivalent to simply teleporting the body; for instance moving a kinematic body by position is not the way to go about things.."
I

"Setting the position of a body is equivalent to simply teleporting the body; for instance moving a kinematic body by position is not the way to go about things.."

I want to use:
movableBall.velocity.x =??
movableBall.velocity.y = ??

movableBall.velocity.x =??  
movableBall.velocity.y = ??  

The final idea is to follow others paths like the Lemniscate of Bernoulli. Thanks!

Moving an object using its velocity on a closed curve

I want that an object follows a path, in Peggle game there are some pegs that have movement in a closed path. How can i get the same result? I guess that I can use parametric curve but I need use the velocity and not the position (x, y).

I use NAPE and I have this in my gameloop:
//circunference angle = angle + 1*(Math.PI / 180); movableBall.position.x = radius * Math.cos(angle)+ h; movableBall.position.y = radius * Math.sin(angle)+ k;

it's works but I can not control the velocity, each movableBall must have its own velocity. Besides, from docs of NAPE:"Setting the position of a body is equivalent to simply teleporting the body; for instance moving a kinematic body by position is not the way to go about things.."
I want to use:
movableBall.velocity.x =??
movableBall.velocity.y = ??

The final idea is to follow others paths like the Lemniscate of Bernoulli. Thanks!

How would I move an object using its velocity on a closed curve?

I want that an object follows a path, in Peggle game there are some pegs that have movement in a closed path. How can i get the same result? I guess that I can use parametric curve but I need use the velocity and not the position (x, y).

I use NAPE and I have this in my gameloop:

//circunference   
angle = angle + 1*(Math.PI / 180);  
movableBall.position.x = radius * Math.cos(angle)+ h;  
movableBall.position.y = radius * Math.sin(angle)+ k;

It works but I can not control the velocity, each movableBall must have its own velocity. Besides, from docs of NAPE:

"Setting the position of a body is equivalent to simply teleporting the body; for instance moving a kinematic body by position is not the way to go about things.."

I want to use:

movableBall.velocity.x =??  
movableBall.velocity.y = ??  

The final idea is to follow others paths like the Lemniscate of Bernoulli.

edited tags
Link
added 651 characters in body
Source Link

I want that an object follows a path, in Peggle game there are some pegs that have movement in a closed path. How can i get the same result? I guess that I can use parametric curve but in Box2D or NAPE I need use the velocity and not the position (x, y).

I use NAPE and I have this in my gameloop:
//circunference angle = angle + 1*(Math.PI / 180); movableBall.position.x = radius * Math.cos(angle)+ h; movableBall.position.y = radius * Math.sin(angle)+ k;

it's works but I can not control the velocity, each movableBall must have its own velocity. Besides, from docs of NAPE:"Setting the position of a body is equivalent to simply teleporting the body; for instance moving a kinematic body by position is not the way to go about things.."
I need ideaswant to use:
movableBall.velocity.x =??
movableBall.velocity.y = ??

The final idea is to follow others paths like the Lemniscate of Bernoulli. Thanks!

I want that an object follows a path, in Peggle game there are some pegs that have movement in a closed path. How can i get the same result? I guess that I can use parametric curve but in Box2D or NAPE I need use the velocity and not the position (x, y). I need ideas.

I want that an object follows a path, in Peggle game there are some pegs that have movement in a closed path. How can i get the same result? I guess that I can use parametric curve but I need use the velocity and not the position (x, y).

I use NAPE and I have this in my gameloop:
//circunference angle = angle + 1*(Math.PI / 180); movableBall.position.x = radius * Math.cos(angle)+ h; movableBall.position.y = radius * Math.sin(angle)+ k;

it's works but I can not control the velocity, each movableBall must have its own velocity. Besides, from docs of NAPE:"Setting the position of a body is equivalent to simply teleporting the body; for instance moving a kinematic body by position is not the way to go about things.."
I want to use:
movableBall.velocity.x =??
movableBall.velocity.y = ??

The final idea is to follow others paths like the Lemniscate of Bernoulli. Thanks!

edited title
Link
House
  • 73.3k
  • 17
  • 185
  • 273
Loading
deleted 25 characters in body
Source Link
House
  • 73.3k
  • 17
  • 185
  • 273
Loading
Source Link
Loading