Third Person Camera

Software: Away3D 4.x

dona, Jr. Member
Posted: 29 April 2012 05:17 PM   Total Posts: 46

Hi guys,

I’m new to Away3D 4.

I’m trying to create a third person camera for a racing game.Now i tried using SpringCam. But i failed to get the exact results. I’m looking to create ‘Max Racer’ (Alternativa3D demo) third person camera..Is there any good tutorials to create chase cam?

Thanks Alot!

   

Nidin, Newbie
Posted: 18 December 2012 05:16 AM   Total Posts: 3   [ # 1 ]

Hi Bro,

This may help you.

var cam_distance:Number = 500;
var 
_scale:Number   = 3;
var 
smooth:Number   = 0.95;
var 
dir:Vector3D   = phyVehicle.getRigidBody().front;
var 
pos:Vector3D   = phyVehicle.getRigidBody().position;
var 
angle:Number   = Math.atan2( dir.z, dir.x);

delta  = new Vector3D(Math.sin( -angle) * cam_distance / 2, 0, Math.cos( -angle) * cam_distance / 2);

var 
pos2:Vector3D = pos.add(new Vector3D( -delta.z * _scale, 200, delta.x * _scale));

 
pos2.x = pos2.x + (_x - pos2.x) * smooth;
 
pos2.y = pos2.y + (_y - pos2.y) * smooth;
 
pos2.z = pos2.z + (_z - pos2.z) * smooth;

_x = pos2.x;
_y = pos2.y;
_z = pos2.z;

view.camera.position = pos2;
view.camera.lookAt(phyVehicle.getRigidBody().position, phyVehicle.getRigidBody().up); 

Thanks & Regards
Nidin

   

Francks, Newbie
Posted: 30 March 2013 06:40 PM   Total Posts: 10   [ # 2 ]

Nice. Thanks mate! This source solved my problem, too. smile

   

Nidin, Newbie
Posted: 30 March 2013 07:01 PM   Total Posts: 3   [ # 3 ]

You are always welcome. smile

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X