-2
votes
1answer
43 views

How do I position a cylinder between 2 points?

I found this code to draw a line between two mouse points. I want to do the same, but inverted; going in the other direction. The line should get larger from my first point toward the second. None ...
0
votes
2answers
128 views

Explaining vector math for a pendulum camera

I came across a code that I guess is doing a pendulum camera, that's the class name. I would like to know the math behind that. I would like also to know how to decipher those stuff in game math, ...
0
votes
1answer
168 views

Repelling a rigidbody in the direction an object is rotating

Working in Unity, I have a game object which I rotate each frame, like so: void Update() { transform.Rotate(new Vector3(0, 1, 0) * speed * Time.deltaTime); } However, I'm running into problems ...
2
votes
1answer
113 views

Unity - Quaternion - Rotate / Unrotate Error

I'm trying to unrotate a quaternion, aligning it with the axis, and then rotate it back to where it was originally. But with every iteration it seems to lose precision and just after 20 iterations the ...
0
votes
1answer
217 views

How do I make an object's y-axis align with a Vector3?

I have a golf ball on the ground, and from a raycast, I have the normal which gives me the slope of the ground by the ball. I have an object which is rendered on the HUD to show that slope to the ...
0
votes
6answers
924 views

Quaternion Lerp never reaches target

I seem to have misunderstood something about how LERP works. Im not sure what is missing. The object is rotating as it should, but it cant seem to get it to end. The transform.rotation dont seem to ...
0
votes
2answers
284 views

Rotate GameObject on click

I'm trying to get a card to flip when clicked but the flipping only works the first flip. While debugging, I can see that OnMouse is called every time I click. public class CardController : ...
1
vote
1answer
326 views

Making player movement direction follow players facing direction

if (controller.isGrounded) { moveDirection = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical")); moveDirection = ...
7
votes
3answers
375 views

Slerping rotation mirrors

I rotate my game character to watch at the target using the following code: transform.rotation = Quaternion.Slerp(startQuaternion, lookQuaternion, turningNormalizer*turningSpeed/10f) ...
0
votes
1answer
332 views

Mouse Aiming Causing Rotation Jitter

When our game's ships move around, mouse aiming causes them to shake around a lot. The body being aimed is moved kinematically. I think we've narrowed it down to this block of mouse tracking code. ...
4
votes
1answer
507 views

Why game engines usually don't offer a vector3.rotate method? [closed]

Game engines like Three.js, Ogre3d and Unity3d often don't provide a default rotate method on their vector class. You usually have to do something like: rotated = vector.applyQuaternion( new ...
1
vote
1answer
553 views

How to get a point to the left/right of a vector

I have a position vector of a point in space and a quaternion for it's rotation. What i'm trying to calculate is a point too the left and a point to the right. I have the position and ...