2

You're not applying just a horizontal force. You're applying a vertical force too. Your desiredVelocity is constructed with a y component of zero, saying "I desire that this object should hover instead of falling," and the rest of the code then tries to honour this stated desire. To fix that, just set delta.y = 0 before you calculate your ...


1

When you set the velocity of your rigidbody directly, then: It will (obviously) cancel all other forces acting on the rigidbody. So you lose the option to use any force-based effects at all on this object. That means no knockback, no explosions, no wind... (unless you program the low-level physics for those yourself) When there are other non-kinematic non-...


1

This solution is for grid based games. The idea is to have "turns". A turn will happen regardless of whatever or not there is input or not. At the end of the turn the avatar will be aligned to the grid, and a turn always takes the same time. Pseudo-code: var current_time = get_current_time(); var elapsed_time = current_time - start_time; ...


1

(I can copy this over to your original question if you'd like to undelete that one and delete/close this one instead) I'd solve this by storing an array of the grid points the snake head has run through, and the next point it's on its way toward. Then we'll store a progress variable between 0 and 1, that represents how far the snake has progressed from its ...


1

Unfortunately I can not provide you with a copy&paste code snippet, because too many details depend on how exactly you set up your scene. So I can only give you a few pointers of what you have to do and what tools you might use to do these things. What you need to do is: Find the pixel-position of the mouse cursor on the screen. Convert it to a position ...


Only top voted, non community-wiki answers of a minimum length are eligible