2025-07-21 05:11 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0003686Spring engineGeneralpublic2013-04-11 20:08
Reportermsafwan 
Assigned ToKloot 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version94.1 
Target VersionFixed in Version 
Summary0003686: free flying ground unit will forcefully orient itself to follow the terrain slope below it
DescriptionLets say you make unit float on water surface (using impulse), then in Spring 94.1) those unit will float but will forcefully orient itself to follow the slope of terrain below it (this is ridiculous since unit are not even touching the ground!).

There is no way to override this orientation. If you force new direction with Spring.SetUnitDirection() or Spring.SetUnitRotation() it still slant like the terrain. In other word: this 2 callins now cannot work.

In Spring 91.0 the unit is upright and can randomly tumble on either side but is not a problem since Spring.SetUnitRotation() works.
Steps To Reproduce
How to reproduce:
constantly apply impulse to unit as to imitate floating on water surface at certain height.
Additional Information

This bug is kind of BIG because now unit can't shoot with this orientation.
Tagsphysic
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0010427

msafwan (reporter)

Last edited: 2013-04-09 13:32

View 4 revisions

This is the gadget: https://code.google.com/p/zero-k/source/browse/trunk/mods/zk/LuaRules/Gadgets/unit_float_toggle.lua

This can be tested on Zero-K r9898 and above.

Just "/give amphassault" near sea shore with hi slope and control the Float/Sink state.

You will see that unit facing upward or downward contrary to behaviour in Spring 91.
-----
Also, a side note:
would be good if Spring DO NOT handle drag by simply multiplying a constant with unit's speed but rather use the physic formula (in the gadget, line 200 & 300) because it allow more advance behaviour like unit bounce off water like rock skipping on pond and allow you to use friction/drag to control unit maximum speed when given unit acceleration (the rock skipping behaviour is currently not in this gadget/under development because it need to detect when player throw unit into air using Newton).

~0010430

emmanuel (reporter)

tested impulse under unit and not keep the ground orientation :
it just depend of where theimpulse is emited from :
maybe its become true if the gravity center is respected accuratly
this trick make sens only if from animdef script
if it just for make a unit floating on sea by gadget it maybe better to kill it and spawn a real hover or boat

~0010431

msafwan (reporter)

Last edited: 2013-04-11 05:32

View 6 revisions

thanks for your feedback, but this bug appear for submerged unit (y<0)

If unit is amphibious and we push it to water surface with impulse and it floats near y == 0 then this unit will orient itself to the ground slope beneath it (a physic bug)!

Okay, lets say you do this to the floating unit:
Spring.SetUnitDirection(unitID,1,0,0)
This will force any unit to face South and flat, but when you do this to floating submerged unit what you'll see is it still orient itself to the ground slope beneath it (even when unit do rotate toward south)!

You will also see some tiny jitter indicating that Spring.SetUnitDirection(unitID,1,0,0) is trying soo hard to make it work but is forced to follow the ground slope below it.

My simple evidence is that I test same gadget on Spring91 and Spring.SetUnitRotation() simply work. This bug is REAL. If Spring dev can help fix it before next Spring release would meant a lot to me!

~0010432

msafwan (reporter)

I have screenshot here: http://s515.photobucket.com/user/xponen/media/Spring94vsSpring91_zpsec8c940c.jpg.html
+Notes

-Issue History
Date Modified Username Field Change
2013-04-09 13:20 msafwan New Issue
2013-04-09 13:25 msafwan Note Added: 0010427
2013-04-09 13:26 msafwan Note Edited: 0010427 View Revisions
2013-04-09 13:30 msafwan Note Edited: 0010427 View Revisions
2013-04-09 13:32 msafwan Note Edited: 0010427 View Revisions
2013-04-09 13:57 msafwan Tag Attached: physic
2013-04-10 16:49 emmanuel Note Added: 0010430
2013-04-11 05:24 msafwan Note Added: 0010431
2013-04-11 05:27 msafwan Note Edited: 0010431 View Revisions
2013-04-11 05:28 msafwan Note Edited: 0010431 View Revisions
2013-04-11 05:29 msafwan Note Edited: 0010431 View Revisions
2013-04-11 05:31 msafwan Note Edited: 0010431 View Revisions
2013-04-11 05:32 msafwan Note Edited: 0010431 View Revisions
2013-04-11 14:47 msafwan Note Added: 0010432
2013-04-11 20:08 Kloot Changeset attached => spring develop 77b42416
2013-04-11 20:08 Kloot Assigned To => Kloot
2013-04-11 20:08 Kloot Status new => resolved
2013-04-11 20:08 Kloot Resolution open => fixed
+Issue History