Questions tagged [physics]

This pertains to the principles of actual physics. If you are looking for guidance on simulating physics in video games, please utilize the [game-physics] tag. For inquiries related to using an established physics engine, use the [physics-engine] tag. Physics is a scientific field that delves into how energy and matter interact. Questions labeled with this tag revolve around incorporating real-world physics concepts into programming simulations.

Calculating Object's Position with Velocity Results in NaN

My goal is to have my canvas arcs (representing dog objects) follow the mouse cursor's movements. However, when I check the position or velocity of the objects using console.log, it shows Vector{ x: NaN, y: NaN} A strange observation is that if I disable ...

formula for an arbitrary velocity vector

In the game I'm developing, I want the ball to move in a random direction on the HTML canvas when it starts, but always with the same velocity. The current code I have is: vx = Math.floor(Math.random() * 20) vy = Math.floor(Math.random() * 20) However, t ...