I'm having an issue where my character is facing 90 degrees away from the (first person) camera. So when I move the character, the model is turned 90 degrees to the right instead of facing forward. (Pic 1)
Since the camera is a child of the player, if I rotate the character -90 degrees, the camera rotates with it. If I rotate my camera back 90 degrees, the controls get messed up (the W to go forward becomes W to go right, etc.) (Pic 2)
Is there anything I can do to either change the default rotation of the
For reference, I am using this FP Controller torah horse(.)com(/)First-Person-Drifter-Controller-for-Unity3d-1 (that uses a cylinder, so doesn't have the same rotation issue)
I'd advise you to put a script on the Camera instead of making it a child of the player. This gives you more freedom in how the Camera behaves.
Actually, looking at your pictures again... Why not just set the Camera behind the player correctly, instead of rotating the player. When you have the Camera as s child it will be responsive to the parents transform, but it wont mimic. It will follow with the same offset as it starts with. So instead of rotating the player, which messes up the controls, simply put the Camera where you want it from the start.
Related
Sorry I know the title is really confusing.
Basically the camera and hands are nested under an empty object. This empty object is then used to rotate the character and teleport the character. Thing is, the camera is able to freely move around and away the empty object. Making rotation seem like you're running in a circle instead of just rotating. Then when you teleport it's a little offset. Like if you shoot the teleport beam straight down you move because it's teleporting the empty object to the camera which moves the camera.
So if the headset and camera aren't exactly on top of the empty object everything gets wonky. I understand the problem just can't figure out a solution.
I tried resetting the position on every teleport but you can still move away and spin in circles. As well as resetting resets the orientation and that's not exactly what I need.
Any help would be greatly appreciated.
There's a few ways to approach this. A crude, and not very elegant solution would be to parent your camera parent to yet another object, created in runtime, that would assume the position of the actual player camera when the rotation starts. You can reparent objects dynamically, so you could rotate this newly spawned object, which would give you the desired effect, and then loose the top parent when the rotation stops.
Alternatively you could move your camera parent as you rotate it, based on transforming the position relative to the player camera position. A bit more elegant but there's probably a few lines of math that you would have to write
I have simulated a rotating cube filled with particles by moving the gravity vector rather than changing all of the geometry. I want to use the ParaView animation tools to rotate the camera to keep the gravity vector pointing down so it all looks right. When moving the camera (not animations) I would use the rotate 90 degrees tools.
How would I achieve this effect for an animation?
EDIT:
I have done it using a video editor as an extra step after ParaView, this is the effect I am going for: https://youtu.be/rym2fdKkPps
You cannot animate GUI button usage with animation. However you can animate camera position and orientation as finely as you want.
Try adding a camera track to the animation track of type "Interpolate Camera Location".
Add the two positions you want and set the time to be very close.
I just want to topple a cube over front side of it. But I can't figure out how can I do this. I'm making a game with dice. It won't be rolled, just rotate 90 degrees and move forward 1 unit. How can I do it? Is there an easy way with rigidbody or should I do it all manually changing position and rotation.
By the way, sorry for bad English.
Get an empty GameObject, lets call it `flipper', and send it to the bottom edge of the cube you want to be pivoted on.
Parent the flipper to the cube.
Rotate flipper by 90 degrees.
Unparent the flipper.
Repeat.
I am working on a tabletop game that user controls using accelerometer in the phone. It is pretty similar to Labyrinth on iOS.
The scene contains a tabletop created using planes and cubes, and a sphere as a ball. As it works in Labyrinth game, on tilting phone ball should drop to the tilted side, while the camera stays centered to table. I am trying to do similar thing where user tilts the phone, and objects on table move to tilted side.
Currently, I add the x and z component to Physics.gravity on tilt. Sadly, this change in gravity does not affect the ball which stays put on the table. Use gravity is selected for the ball, and it drop down from height to the tabletop initially and then comes to halt. After the initial drop, ball does not react to any gravity change.
I have also tried rotating the whole table, but using transform.rotate does not work either. The table rotates perfectly, alongwith the camera, but the ball stays put hanging in the air. So, currently I am out of my depth about the issue.
Is there any other way to allow tilt action registered, so that ball moves to the tilted direction? I cannot use addforce function, as there are multiple objects which need to react to tilt, and it will be difficult to keep track of that many addforce calls. How else can I get it working?
See this post for some related information.
As for why your sphere is sticking to the table, can I assume your sphere has a rigidbody? If so, you need need to wake it up:
if (rigidbody.IsSleeping())rigidbody.WakeUp();
Ideally you would make that call only after detecting a change in orientation/gravity, not every frame.
I'm trying to create a chipmunk space with a bouncing ball.(Example seen here)
Currently my device is running in Landscape mode. So according to cocos2D everything is all right. When adding Sprites they orient to landscape mode.
[director setDeviceOrientation:kCCDeviceOrientationLandscapeLeft];
The only problem is that the device orientation is screwed up when using chipmunk right now. When tilting the ipad towards the upper-left corner, my 'bouncing ball' moves towards the upper-right corner.
Is there a way to rotate a chipmunk space manually?
Or is there some other way to set rotation within a chipmunk space?
It sounds like a simple sign issue. I assume the balls are moved by applying a force to them. So instead of applying a positive force like (10, 0) apply a negative force (-10, 0) when moving the balls in one direction, and do the reverse in the other (eg multiply x coordinate forces by -1). Chipmunk doesn't care or know about device orientation, it just moves objects according to forces and gravity.