Tempest_design

08-27-2002, 02:15 PM

ok I've just begun to mess with making a psudo 3d engine.

The engine takes the x,y of the camera object and the x,y of an icon object (both invisible) and translates it to a third scale object.

Here is the code inside the third "visible" object

onClipEvent(enterFrame){

Radians = Math.atan2((_root.camera._y-_root.block._y), (_root.camera._x-_root.block._x));

_root.point_dir = Math.round(Radians*180/Math.PI);

directionz=_root.point_dir+(360-_root.camera._rotation)/2-90;

directionz-=800-((directionz)*5.1);

_x=directionz;

}

( problem ) I realize Flashs coord system goes from 0-180 & -180-0 degrees (translated from Radians)

I'm used to doing this with a 360 degree rotation.

And so if the camera object is <_root.block._y then everything goes reverse. I've fixed this to some extent by saying:

onClipEvent(enterFrame){

if(_root.camera._y>_root.block._y){

Radians = Math.atan2((_root.camera._y-_root.block._y), (_root.camera._x-_root.block._x));

_root.point_dir = Math.round(Radians*180/Math.PI);

directionz=_root.point_dir+(360-_root.arrow._rotation)/2-90;

directionz-=800-((directionz)*5.1);

}else{

Radians = Math.atan2((_root.block._y-_root.camera._y), (_root.camera._x-_root.block._x));

_root.point_dir = Math.round(Radians*180/Math.PI);

directionz=_root.point_dir+(360-_root.arrow._rotation)/2-90;

directionz-=800-((directionz)*5.1);

_x=directionz;}

}

But it's still not quite right. In fact sometimes for some reason the view is all backwards!

Anyways does anyone have a means to translate a 360 degree rotation? ( 0-360 degrees )

The engine takes the x,y of the camera object and the x,y of an icon object (both invisible) and translates it to a third scale object.

Here is the code inside the third "visible" object

onClipEvent(enterFrame){

Radians = Math.atan2((_root.camera._y-_root.block._y), (_root.camera._x-_root.block._x));

_root.point_dir = Math.round(Radians*180/Math.PI);

directionz=_root.point_dir+(360-_root.camera._rotation)/2-90;

directionz-=800-((directionz)*5.1);

_x=directionz;

}

( problem ) I realize Flashs coord system goes from 0-180 & -180-0 degrees (translated from Radians)

I'm used to doing this with a 360 degree rotation.

And so if the camera object is <_root.block._y then everything goes reverse. I've fixed this to some extent by saying:

onClipEvent(enterFrame){

if(_root.camera._y>_root.block._y){

Radians = Math.atan2((_root.camera._y-_root.block._y), (_root.camera._x-_root.block._x));

_root.point_dir = Math.round(Radians*180/Math.PI);

directionz=_root.point_dir+(360-_root.arrow._rotation)/2-90;

directionz-=800-((directionz)*5.1);

}else{

Radians = Math.atan2((_root.block._y-_root.camera._y), (_root.camera._x-_root.block._x));

_root.point_dir = Math.round(Radians*180/Math.PI);

directionz=_root.point_dir+(360-_root.arrow._rotation)/2-90;

directionz-=800-((directionz)*5.1);

_x=directionz;}

}

But it's still not quite right. In fact sometimes for some reason the view is all backwards!

Anyways does anyone have a means to translate a 360 degree rotation? ( 0-360 degrees )