1
vote
0answers
32 views

Unity 2D angular velocity center [duplicate]

I try to add angular velocity to my GameObject with this command: rigidbody2D.angularVelocity = Random.value * tumble; All works, but I want center of velocity be in the center of my rigidbody, but ...
0
votes
1answer
50 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 ...
0
votes
1answer
58 views

Can I have a fixed-angle sprite with a non-fixed-angle CircleCollider2D?

In Unity2D, can I have a fixed-angle sprite with a non-fixed-angle CircleCollider2D? I would like to move my character using the circle physics (without fixed-angle), but display him always as if he ...
1
vote
0answers
82 views

Unity crashes completely when I rotate my objects

I've started my first tiny Unity project and after 20 minutes I run into a brick wall. My goal was to create a Android 2D game with falling polygons, that you have to click and they disappear. ...
2
votes
1answer
77 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 ...
1
vote
1answer
245 views

Unity objects not rotating around pivot point

Suddenly, for some reason, objects in the unity editor started rotating around their center of gravity (at least that's what I think is going on) instead of their pivot point. I tried placing the ...
1
vote
1answer
161 views

How to translate swipe gestures into rotations?

I am making a snake game. I want to rotate my snake in the direction specified by swiping on the screen, the directions are limited to orthogonals (90 degree increments). It's an android game. Can ...
1
vote
1answer
207 views

Rotating a GameObject around its center

I'm trying to rotate a GameObject that consists of several cubes around its center of gravity on an axis. When using transform.Rotate(), it rotates around its pivot point (as shown in picture 1) and ...
-1
votes
1answer
107 views

lerp z rotation towards mousepointer

I am trying to get transform.rotation.z to chase the mouse pointer at a rotation speed. But I get a very weird results and can't figure out what I am doing wrong. var mp = Input.mousePosition; ...
2
votes
1answer
445 views

How do I make an object face the mouse position, but only on one plane?

I want a game object to turn and look towards where the mouse was clicked (in world space). It works well when considering all 3 dimensions, but I really only care for the plane formed by the x and z ...
1
vote
1answer
232 views

Making player movement direction follow players facing direction

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

Rotate to a set degree then reverse and repeat in Unity

I'm making my first project in Unity, a simple game where touching objects adds points to the player's score. I'd like the objects to have a pleasant back and forth swaying animation on the Z axis. ...
7
votes
3answers
362 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
253 views

Rotating object along bezier curve: not rotating enough?

I tried to follow the instructions from the threads on the forum (Cocos2d rotating sprite while moving with CCBezierBy) with Unity, in order to rotate my object as it moves along a bezier curve. But ...
4
votes
1answer
238 views

Keep cube spinning after fling

So I've been trying to get started with game development for Android using Unity3D. For my first project I've made a simple cube that you can spin using touch. For that I have the following code: ...
0
votes
3answers
4k views

Unity3D Orbit around orbiting object (transform.RotateAround)

The best way to explain this is I'm attempting to make a small model solar system (not to scale or anything complicated, just simple rotation as a learning exercise). There's a sun, a planet, and that ...
0
votes
1answer
6k views

Rotate an object smoothly on the Y axis in Unity

I am attempting a simple script to swing a door open in Unity. This requires a smooth rotation of 90 degrees around the Y axis. I have seen that one way to do this is using Unity's Quanternion ...
1
vote
1answer
129 views

Getting mousemovement despite mouselock - unity

I have lockcursor so the cursor doesn't leave the screen, but now i have to rotate an object based on mouse movement (think garrys mod item rotation) but the mouse cursor is obviusly locked to the ...
0
votes
0answers
99 views

Follow sinus with absolute value

I would like to make an arm follow the sinus of the ball. When I add an absolute value to the ball (on the y axis) to get a more realistic bounce, the ball is going 2 times faster. How could I ask ...
1
vote
0answers
269 views

Move parent according to child axis in Unity?

Can I ask my parent to move according to the child axis? This means if I turn right, then right again, the parent has to be at 180° from its original position, and not only at 90° (because "Right" ...
0
votes
1answer
279 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. ...
2
votes
1answer
118 views

Rotation independent rotation

I came up with some cube rotating, but I could not make it smooth and easy to use because as the cube turned - the keys that handle the turning changed their purpose. Link to demo. The demo rotation ...
1
vote
1answer
364 views

Weapon as camera's child, rotation messed up

I put my weapon as a camera child, it works, but when i rotate my player it seems the weapon rotate a little too. I'll attach some images so you can see it. As you can see, when i look up i ...
3
votes
3answers
1k views

Getting correct angles between Vector3s

I'm working on a project where you can draw lines between points. You select one point and drag the mouse onto another point and a line is drawn between them. The line itself is a 3d object which is ...
1
vote
1answer
485 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 ...
1
vote
1answer
3k views

Rotate to a set degree then stop Unity [closed]

I'm trying to make an object rotate up on the Y axis 90 degrees, then stop. I've got the rotating up bit working fine, it's getting it to stop once it hits 90. Some of the things I've tried include ...
1
vote
1answer
739 views

Scene graph in Unity3D

I was wondering if any scene graph-like mechanism is implemented into Unity3D? For example if I have a GameObject, can I add child cubes to it so when I rotate the parent GameObject, the siblings will ...
5
votes
1answer
4k views

Angle between two points

I have a character who walks to random points in my room in Unity. The problem is he always faces one direction, I want to write in C# a piece of code that will get the direction the character is ...
0
votes
1answer
442 views

Character rotating around target

I'm using xaitment plugin for Unity as the AI for a demo level but I have a problem. My character is supposed to walk to random points but while it's walking there it's rotating around the point. I ...
2
votes
5answers
3k views

How to make something rotate a certain amount over an exact amount of time

I'm trying to make a plane rotate down a certain amount and 180 degrees horizontally over 2 seconds. Basically I want it to take the plane 1 second to rotate to a horizontal-facing angle, then take ...
2
votes
1answer
2k views

How to control a spaceship near a planet in Unity3D?

Right now I have spaceship orbiting a small planet. I'm trying to make an effective control system for that spaceship, but it always end up spinning out of control. After spinning the ship to change ...
2
votes
1answer
1k views

How can I create my mesh so that textures applied to it are NOT rotated 90 degrees in Unity 3D?

I'm trying a really simple test in Unity 3D. I want to render a texture on the simplest plane possible. So, I've created a two-triangle plane in Blender, then imported it into Unity. From there, I ...
2
votes
1answer
3k views

2d tank movement and turret solution

I'm making a simple top-down tank game on the ipad where the user controls the movement of the tank with the left "joystick" and the rotation of the turret with the right one. I've spent several hours ...
2
votes
2answers
2k views

Weird rotation problem

I'm creating a simple tank game. No matter what I do, the turret keeps facing the target with it's side. I just can't figure out how to turn it 90 degrees in Y once so it faces it correctly. I've ...