I want the space fighter AI to rotate and move. I’m using AddActorLocalRotation, which seems to work okay so far.
But I want it also to roll. Setting values for the roll makes the fighter to do spiral movements, which I don’t want.
I want it to roll independently while it’s doing maneuvers. I tried other nodes like
AddRelativeRotation, AddLocalRotation and even AddTorque. But none of them work.
AddActorWorldOffset and AddActorLocalRotation are connected to a sequence node and are being called on tick.
So what am I doing wrong here?
Hey @User345546056, The roll node just influences the rolling of the X axis. When just used raw it will only ever do a star fox barrel roll without extra logic preceding it. Just to clarify, were you attempting to make the ship incorporate rolls in it’s natural movement? I.e. if it were to try to turn around it would roll to the right and then “Pull up” when it’s on it’s side?
Hi @SupportiveEntity ,
were you attempting to make the ship incorporate rolls in it’s natural movement? I.e. if it were to try to turn around it would roll to the right and then “Pull up” when it’s on it’s side?
yes, both of them. So with incorporating roll you mean like in the gif below, right? Like an aileron roll.
The second maneuver I also want to implement. So where the ship might not roll completely around its axis and pulls up when exiting the maneuver. (Or does it actually roll completely around it’s axis while following the turning path? I’m not even sure…)
I would like to understand how to control rolling also in general.
When I type in the value 1 for the roll, and non-zero values for pitch and yaw, this happens (the red fat line represents the path the
AI is moving along) :
But I would like to know how to achieve this:
Hey @User345546056, I have an idea of what may be occurring. So excuse my terminology, the stationary Aileron roll should be what occurs if the pivot point for the object you’re rotating on the Z axis is centered. For reference, a quick little ship I put together here is performing the stationary roll and the only thing influenced is the Roll value you have there.
So I think that the pivot point for your ship may be set at a location other than center (or centered on where you want the roll to center on). There’s a decently easy fix for this one if that’s the case. So first check and see if the pivot itself is offset from the center, if it is you can move it 2 ways
In Engine: By using the transform tool and then hitting ALT + MiddleMouse to move the pivot, then Right-click the actor and choose Pivot > Set as Pivot Offset to save it. Warning, this permanently sets that objects pivot.
In your modeling program.
alternatively if the pivot is actually in the correct location and it’s still rotating offset, there might be something else at play. With just that roll firing it should only be doing the aileron roll as expected, but that wouldn’t cause any movement besides the rotation even if offset. If this is the case could you briefly disable the movement components, make sure the pivot is in place, and then try the pure rotation and let me know how it goes. I’ve got a couple of other possible things but those 2 are the most common.
Hi @SupportiveEntity ,
the pivot point of the ship is already exactly on the center of the mesh and for (1,0,0) it does a clean aileron. But not for (1,y,0), (1,0,z) or (x,y,z) in general. In that cases it goes sideways with spiral movements. Is it ok to connect a vector to AddActorLocalRotation? Maybe that’s causing trouble. Although I see no difference between a Rotator and a Vector that is connected to AddActorLocalRotation.
Ahhh I see, so the local rotation shouldn’t itself cause any movement in and of itself, but it will start spiraling whenever the other rotations are applied as it’s basically requesting to rotate say 50x and 50z, it’ll rotate them both at once causing the spiral you see. If I were to be implementing plane like controls, the design I went with would be a parent object controls true rotation, and the ship is a child of it that controls just the roll itself. From there you can point the ship however you please and roll as you see fit without possibly muddying up your rotations from trying to local rotate on two axis’s.
I’ll take a quick minute and work up a test.
So you mean something like this:
ParentShip → Ship → other child components…
And I apply AddActorLocalRotation for y and z to ParentShip and only x for Ship?
Will test it out soon.