Hard Light Productions Forums

Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: FreeSpaceFreak on June 28, 2011, 03:38:41 pm

Title: Set-object-facing-object: rotation time?
Post by: FreeSpaceFreak on June 28, 2011, 03:38:41 pm
In the set-object-facing-object SEXP, the logic of the rotation time is rather fuzzy. Use a short value, and the ship will spin like a top; use a realistic (i.e. long) rotation time and the ship doesn't get to the right direction. Demonstration mission (FSO 3612, no mods) attached.

Has anyone run into this before, gotten it working, or found a decent workaround?

[attachment deleted by ninja]
Title: Re: Set-object-facing-object: rotation time?
Post by: Rodo on June 28, 2011, 04:10:23 pm
Try creating a new camera before using any of the facing-object sexps, that might help.

Title: Re: Set-object-facing-object: rotation time?
Post by: zookeeper on June 28, 2011, 04:30:34 pm
If it works anything like the set-camera-facing* SEXPs, a few possibilities come to mind:

1. You might need to reset the facing of the object to the default orientation first. EDIT: Nevermind that, I was thinking of something else.
2. The object will face the location where the target object was at the start of the turn, not where it is at the end.
Title: Re: Set-object-facing-object: rotation time?
Post by: Spoon on June 28, 2011, 04:30:48 pm
It's a wonky sexp, best used with a repeat/everytime kinda setup
Title: Re: Set-object-facing-object: rotation time?
Post by: Rodo on June 28, 2011, 10:17:21 pm
I thought you where using a ship as a camera, never mind that earlier post of mine I have no clue as to why this happens.

Why not using an attack order with locked turrets/ignore orders and then reset the orders after a second?
Title: Re: Set-object-facing-object: rotation time?
Post by: FreeSpaceFreak on June 29, 2011, 02:47:18 am
2. The object will face the location where the target object was at the start of the turn, not where it is at the end.

I'm pointing to a still object, see demonstration mission.


It's a wonky sexp, best used with a repeat/everytime kinda setup

I guess... but how would that work? You'd need something like "every-time (not (ship is facing object))", but I can't find the "ship is facing object" SEXP for non-player ships.


Why not using an attack order with locked turrets/ignore orders and then reset the orders after a second?

1. Attack orders are not guaranteed to point the ship towards its target, at close range it will start to run circles around the target.
2. I'd prefer the pointing ship not to move (or as little as possible), because of collision danger.
Title: Re: Set-object-facing-object: rotation time?
Post by: Goober5000 on June 29, 2011, 03:01:28 am
It's a very badly written sexp (by yours truly when I somewhat unsuccessfully tried to bypass the AI system).

The problem is that the game will apply a torque to the object to get it to rotate, but the torque will only be active in the frame in which it is called.  So you'll need to use the every-time sexp to ensure that the torque is applied every frame.
Title: Re: Set-object-facing-object: rotation time?
Post by: zookeeper on June 29, 2011, 03:14:07 am
The problem is that the game will apply a torque to the object to get it to rotate, but the torque will only be active in the frame in which it is called.  So you'll need to use the every-time sexp to ensure that the torque is applied every frame.
Well, unless it's getting fixed sometime soon, that detail should really be added to the SEXP description.
Title: Re: Set-object-facing-object: rotation time?
Post by: FreeSpaceFreak on June 29, 2011, 04:28:27 am
1. Make set-object-facing event
2. Add repeat count
3. ?????
4. The ship is ticking like the second hand of a clock.

Bah, it'll have to do... rotdamp makes the ticking not too obvious.
Title: Re: Set-object-facing-object: rotation time?
Post by: Sushi on June 29, 2011, 07:20:40 am
1. Make set-object-facing event
2. Add repeat count
3. ?????
4. The ship is ticking like the second hand of a clock.

Bah, it'll have to do... rotdamp makes the ticking not too obvious.

Try the following:

1. Use every-time instead of when.
2. Add trigger count, leave repeat-count alone.
3. Set interval time to 0 (not sure if you need this or not for every-time)...
Title: Re: Set-object-facing-object: rotation time?
Post by: CooperHawkes on June 29, 2011, 02:24:19 pm
no offence goober, but most of the time set-object-facing(-object) acts like "im going to do whatever i want to do!". but with your explanation it gets a lot clearer why it acts like it does.
an overhaul of this sexp would be much appreciated. would make something im trying to realise atm a lot easier if this sexp/s would work like it/they should.

be aware that everytime-events are very framerate depentend. outcomes may differ vastly with different FPS.
Title: Re: Set-object-facing-object: rotation time?
Post by: Spoon on June 29, 2011, 05:37:11 pm
Do keep in mind that overhauling this sexp to work 'like it should' could potentially break already released campaigns that use the sexp in the way it works currently.
Title: Re: Set-object-facing-object: rotation time?
Post by: CooperHawkes on June 29, 2011, 05:45:07 pm
ok, point taken. how about a new "set-object-facing-(for-real-this-time)" sexp?
Title: Re: Set-object-facing-object: rotation time?
Post by: Sushi on June 29, 2011, 06:30:56 pm
ok, point taken. how about a new "set-object-facing-(for-real-this-time)" sexp?

I suspect what you really want is a "turn-towards-object" SEXP that actually does hook into the AI for making one object face another...
Title: Re: Set-object-facing-object: rotation time?
Post by: Droid803 on June 29, 2011, 06:45:31 pm
Do keep in mind that overhauling this sexp to work 'like it should' could potentially break already released campaigns that use the sexp in the way it works currently.

Could always add an extra argument that controls whether to use it the "right" way, or the "old" way, and defaults to the old way...