- Home /
hello's i needs help on camera movement
hello i ive been trying to modify the mouseOrbit script from unity im trying to orbit the camera around the obj when the mouseX/Y is stop moving a couple of seconds later i want it to go back to the default position also im trying to making the script goto a other camera smoothly insted of it going instant with no smoothing know what mean
im not asking for code im just asking howto do it
this is the default code im modifying
var target : Transform;
var distance = 10.0;
var xSpeed = 250.0;
var ySpeed = 120.0;
var yMinLimit = -20;
var yMaxLimit = 80;
private var x = 0.0;
private var y = 0.0;
@script AddComponentMenu("Camera-Control/Mouse Orbit")
function Start () {
var angles = transform.eulerAngles;
x = angles.y;
y = angles.x;
// Make the rigid body not change rotation
if (rigidbody)
rigidbody.freezeRotation = true;
}
function LateUpdate () {
if (target) {
x += Input.GetAxis("Mouse X") * xSpeed * 0.02;
y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02;
y = ClampAngle(y, yMinLimit, yMaxLimit);
var rotation = Quaternion.Euler(y, x, 0);
var position = rotation * Vector3(0.0, 0.0, -distance) + target.position;
transform.rotation = rotation;
transform.position = position;
}
}
static function ClampAngle (angle : float, min : float, max : float) {
if (angle < -360)
angle += 360;
if (angle > 360)
angle -= 360;
return Mathf.Clamp (angle, min, max);
}
i would help you but some dumb moderator rejected my Question for no reason at all sorry i have to make sure he pays for it.
@SlitherGod I'm sure the moderator who rejected your question must have rejected for a reason usually like lack of information, lack of research, and so on. Just so you know there are issues with send message feature available for moderators. $$anonymous$$oderators just don't reject questions for no apparent reason.
Also, how does helping him has anything to do with your question being rejected? And how come not answering him is gonna make the moderator who rejected your question pay for what he did?
@SlitherGod - Questions are rejected all the time. Unity Answers is not a support forum that accepts all questions. I went back and looked at your rejected question. Reading the reference for GUI.Button(), and perhaps testing out the example script in the reference page, will solve your problem. And punishing 'alexander11' (assu$$anonymous$$g you had an answer which I doubt) is a strange way to make your point.
Answer by zzzzz · Sep 18, 2014 at 11:15 PM
Do you mean by Smoothly...that you want it Animate to another position? Move there over time?
If so, use iTween
Check out http://itween.pixelplacement.com/documentation.php
not really what i need but it will do the trick thx mate
Your answer
Follow this Question
Related Questions
Raycast Car-Vehicle Physics 1 Answer
Camera raycast and rotated collider 0 Answers
Raycast car tutorial from Flashbang? 0 Answers
Raycast align with ground normal 2 Answers
Raycast Car Physics 0 Answers