# Custom turning

Status
Not open for further replies.

#### darwin

Level 14
I'm working on a car map and want to turn my cars manually so that I can force spin outs and such. I think it'll work, but I've come across a few problems that I'm hoping someone can help me with.

I tried putting a Unit face angle action in a repeated trigger (fires every 0.0 seconds...which translates into 16 fires per second). The unit looks terrible when this is done though; it's incredibly choppy. The move action can be blended, but repeated turning of the unit cannot.

question 1: is there any way around this other than using the "Unit - Make (Triggering unit) face point over <time> seconds" action that has the wait built in? I've used that, and it works, but it makes a lot of physics calculations harder (like the effects of hills on turns and such).

question 2: The turn action always takes the fastest route, either left or right, to face the point. Is there a way to make a unit turn slowly from say 0 to 280 but by turning right rather than left?

The only idea I had so far was to make it turn 179 degrees over some time, then waiting that time and finishing the turn. That works, but again becomes very complicated.

#### Dr Super Good

Spell Reviewer
Level 63
native void UnitSetFacing (unit inUnit, fixed inFacing, fixed inDuration);
That is the only way. I do not see the problem if you make it rotate over 0.0625 seconds and update every 0.0625 seconds. There is ofcourse actor rotation (via actor methods) you could try ontop of this, but again it uses a simlar system of blending and is prone to reset after a unit moves.

question 2: The turn action always takes the fastest route, either left or right, to face the point. Is there a way to make a unit turn slowly from say 0 to 280 but by turning right rather than left?
Doing this makes little sense from a mathimatical point of view. If you absolutly must do this for vistuals, you will need to break it into 2 parts. For 0 to 280 that could easilly be 0 to 140 and then 140 to 280 (both the optimum turning). Timing could be a problem with this.

#### darwin

Level 14
That is the only way. I do not see the problem if you make it rotate over 0.0625 seconds and update every 0.0625 seconds. There is ofcourse actor rotation (via actor methods) you could try ontop of this, but again it uses a simlar system of blending and is prone to reset after a unit moves.

Doing this makes little sense from a mathimatical point of view. If you absolutly must do this for vistuals, you will need to break it into 2 parts. For 0 to 280 that could easilly be 0 to 140 and then 140 to 280 (both the optimum turning). Timing could be a problem with this.

Oddly, I hadn't tried making it rotate over .0625 seconds... that works wonderfully, thank you! While I was waiting for responses here I tried the second method (turning 179 degrees first, waiting, then turning another 101)...it worked out okay actually, but it was complicated and would make spinning a car around in a circle really difficult. Anyway, wonderful job as always! I hope my repeated questions aren't annoying.

Status
Not open for further replies.

Replies
0
Views
578
Replies
3
Views
516
Replies
4
Views
625
Replies
5
Views
610
Replies
4
Views
781