Translation and Rotation controls now function
This commit is contained in:
21
script.js
21
script.js
@ -301,24 +301,9 @@ function animate() {
|
||||
ctx.translate(canvas.width / 2, canvas.height / 2);
|
||||
|
||||
// Animation for testing
|
||||
xSpeed += xDir;
|
||||
ySpeed += yDir;
|
||||
turnSpeed += turnDir;
|
||||
if (xSpeed > 100)
|
||||
xDir = -1;
|
||||
else if (xSpeed < -100)
|
||||
xDir = 1;
|
||||
|
||||
if (ySpeed > 100)
|
||||
yDir = -0.8;
|
||||
else if (ySpeed < -100)
|
||||
yDir = 0.8;
|
||||
|
||||
if (turnSpeed > 1)
|
||||
turnDir = -0.01;
|
||||
else if (turnSpeed < -1)
|
||||
turnDir = 0.01;
|
||||
|
||||
xSpeed = vxSlider.value;
|
||||
ySpeed = vySlider.value;
|
||||
turnSpeed = omegaSlider.value;
|
||||
|
||||
// Animate the grid with robot movement
|
||||
let offsetSpeedDivisor = (100 - gridSquareSize <= 0 ? 1 : 100 - gridSquareSize);
|
||||
|
||||
Reference in New Issue
Block a user