# playMaker

### Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

### Messages - Abhishekrazy

Pages: [1]
1
##### Playmaker Help / Re: Camera rotation and Player movement
« on: September 07, 2015, 11:53:09 PM »
I also want to add force to be added in camera facing direction.

2
##### Playmaker Help / Camera rotation and Player movement
« on: August 30, 2015, 12:11:43 AM »
How do i make this type of camera with playmaker.

https://youtu.be/QQ3T8CikEVM

3
##### User Showcase / How do i convert this script in playmaker nodes
« on: August 24, 2015, 12:09:19 PM »
I only want to rotate my camera along the movable object with swipe rotation if this is possible please help me

I spend lot of time to make my camera rotate along the object but not succeed so finally i got this script.

i dont know what this script accully does.

var target : Transform;
var distance = 2.0;

var xSpeed = 180.0;
var ySpeed = 90.0;

var yMinLimit = 0.0;
var yMaxLimit = 80;

var speed : float = 0.14;

private var x = 0.0;
private var y = 0.0;

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 && Input.GetMouseButton(0)) {
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);
}

function Update () {

transform.LookAt(target);

transform.position -= transform.right * speed * Time.deltaTime;

if (Input.GetMouseButton(0)) {
transform.LookAt(target);
transform.RotateAround(target.position, Vector3.up, Input.GetAxis("Mouse X")*speed);
}

}

Pages: [1]