Smooth Model movement/rotation, ACS *.bin decompile

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Smooth Model movement/rotation, ACS *.bin decompile

Re: Smooth Model movement/rotation, ACS *.bin decompile

by Guest » Sun Jan 06, 2019 12:07 am

I was just going to post a thread asking this very question, but a search led me here. Unfortunately, the solution seems inconclusive. Does Gutawer have an example mod or tutorial that shows how these so called Quaternions work?

Re: Smooth Model movement/rotation, ACS *.bin decompile

by gramps » Sun Dec 16, 2018 2:00 pm

This thing Gutawer wrote really has a pretty nice simple API... part of the issue here, with no "private" or "public" it might not be obvious which stuff you're supposed to be using and which stuff is internal.

I think in a case like this you'd want one quaternion representing the new angle, and one representing the old angle, and lerp between them; and then use the function that decomposes the thing back into yaw, pitch and roll.

If lerping doesn't feel smooth enough, you could rework that bit to put an easing function ahead of the lerp by manipulating the "time" value, something like a waveshaper. This is a little hard to describe properly, but look at the difference between the red and blue line here between 0,0 and 1,1; the red line represents a lerp and the blue line represents an eased lerp.

(demo)

You could also do this with sin or atan or a number of heavy things, or with the usual jerky cubic and co, but a low-order approximation of a sine like this should get you the most bang for your buck. I think. Unless regular sine is actually cheaper?

Re: Smooth Model movement/rotation, ACS *.bin decompile

by Apeirogon » Sun Dec 16, 2018 1:23 pm

Quaternions have one fatal flaw, they dont have much of a "how to turn things using quaternions for dummy" manuals in the internet.

Re: Smooth Model movement/rotation, ACS *.bin decompile

by gramps » Sat Dec 15, 2018 6:55 pm

Smooth Model movement/rotation, ACS *.bin decompile

by Cherno » Sat Dec 15, 2018 3:01 pm

Two related questions.

As we all know, when using models for actors, the monster movement code makes the whole thing look weird with all the teleporting and insta-snapping to new angles all the time. There has been talk about using invisible actors that are in turn followed (smoothly) by model-only actors, but no tutorial for this as I know of. The only thing I was able to find out is that Total Chaos uses a system like that.

Code: Select all

actor brute_ambush 30031
{

//...

        var int user_displayTid;
	var int user_status;
	var int user_hasTether;
	var int user_seenPlayer;
	
	States
	{
		Spawn:
			AITE A 1
			AITE A 1 A_JumpIf(user_hasTether == 1, "SpawnActive")
			AITE A 1 ACS_NamedExecuteAlways("TetherAi", 0, 0, 10, 0)
			AITE A 100
			AITE A 0 A_SetUserVar("user_hasTether", 1)
			AITE A 1 ACS_NamedExecuteAlways("AiSetStateFromTable", 0, user_displayTid, 1, 1)
		SpawnActive:
			0000 ABCDEFGHIJKLMNOPQRSTUVWXYZ 1 A_Look
			0001 ABCD 1 A_Look
			loop
		See:
			AITE A 0
			AITE A 1 ACS_NamedExecuteAlways("AiSetStateFromTable", 0, user_displayTid, 1, 1)
			AITE A 0 A_SetUserVar("user_seenPlayer", 1)
			//AITE A 0 A_PlaySound("ai/brute/see", CHAN_AUTO)
                 //...
        }
}

So, the model-only actor is spawned in this actor's spawn state, and all further states somehow make the model-only actor change it's state, too (lookup table?). I assume that each actor that has a tether like this also has to havev a unique TID set when spawning.

Unfortunately, I wasn't able to find the model-only acto code, and the ACS file is a *.bin (as opposed to a *.o) so I couldn't decompile it to see the code.

So, does anyone have experience with smooth model movement and rotation? Can anyone make sense from the way Total Chaos did it? Is there a way to decompile *.bin ACS files?

(I desperately need it for my Alone in the Dark TC :) )

Top