UltraEd icon indicating copy to clipboard operation
UltraEd copied to clipboard

Support world and local rotations on N64

Open deadcast2 opened this issue 4 years ago • 2 comments

deadcast2 avatar Sep 05 '21 15:09 deadcast2

is there a way to rotate in a script? And of course change the position in a script.

Sammyueru avatar Jan 06 '22 23:01 Sammyueru

Yeah you can currently rotate by accessing the rotationAxis and rotationAngle properties on the Actor object. Below is an example of continually rotating the actor this script is attached to:

void $Update(Actor *self)
{
	if(self->rotationAxis.y < 0)
	{
		self->rotationAngle = -self->rotationAngle; 
	}
		
	self->rotationAxis.x = 0;	
	self->rotationAxis.y = 1;
	self->rotationAxis.z = 0;
}

To translate you can modify the position property. It contains 3 components x, y and z. So to move forward you could do

self->position.z += 0.1f

I'd like to add some more convenience methods to make this a bit easier. If you study the actor.h file in the engine directory you'll see what is able to be modified. https://github.com/deadcast2/UltraEd/blob/master/Engine/actor.h

deadcast2 avatar Jan 08 '22 02:01 deadcast2