• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Making a 'mobile platform'

Status
Not open for further replies.
Level 11
Joined
Oct 16, 2013
Messages
246
Is it possible to make a 'mobile platform' where units stand and walk on it without getting moved by the 'platform' movement? For example, think about a ship carrying a few pirates and cannons that can get in/leave and can be moved freely around the deck. Suggestions and ideas are welcome. Thank you in advance.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Is it possible to make a 'mobile platform' where units stand and walk on it without getting moved by the 'platform' movement?
Confusingly worded. I think you mean "their position is relative to the platform so will move with the platform".

Using SetUnitX/Y you can move units instantly without cancelling their current orders. Making units have the correct facing without cancelling orders I think is impossible (so units will not change facing when the platform rotates).

The idea is a trigger system that attaches units "on the platform" to the platform. Every time the platform is moved (actions after the trigger script that moves it or if it moves naturally you need to periodically check for movement) you apply the movement delta to all units "on the platform" via SetUnitX/Y. This will give you basic straight line movement capabilities for the platform.

Rotating platforms are slightly more complicated as you also need to monitor platform facing. If trigger controlled, run after that or if natural you need to periodically check facing. When rotation is detected you need to rotate all units "on the platform" using the centre of the platform as the origin and distance as an offset by the angle the platform rotated.

Unit rotation would also need to be adjusted by the amount platform has rotated for perfect results but this will interrupt unit orders sadly.

The process of rotation might be optimally done via a rotation matrix which you can also use to apply the platform movement at the same time.
 
Status
Not open for further replies.
Top