Difference between revisions of "Talk:SetVelocity"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>DragoonWraith
imported>DragoonWraith
Line 36: Line 36:
:I suggest that you mention this in the [http://forums.bethsoft.com/index.php?/topic/1217754-relz-oblivion-script-extender-obse-0020-unofficial/ OBSE thread] on the official forums. To the best of my knowledge, it is the only place that anyone from the OBSE team checks regularly. That includes the Wish List.
:I suggest that you mention this in the [http://forums.bethsoft.com/index.php?/topic/1217754-relz-oblivion-script-extender-obse-0020-unofficial/ OBSE thread] on the official forums. To the best of my knowledge, it is the only place that anyone from the OBSE team checks regularly. That includes the Wish List.


:Also, you can use <nowiki>~~~~</nowiki> to sign comments easily, rather than typing out your signature each time, which it appears you've maybe done?
:Also, you can use <tt><nowiki>~~~~</nowiki></tt> to sign comments easily, rather than typing out your signature each time, which it appears you've maybe done?
:[[User:DragoonWraith|<span style="font-family: Oblivion; size=2;">D</span>ragoon <span style="font-family: Oblivion; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion; size=2;">TALK</span>]] 16:00, 27 August 2011 (EDT)
:[[User:DragoonWraith|<span style="font-family: Oblivion; size=2;">D</span>ragoon <span style="font-family: Oblivion; size=2;">W</span>raith]] [[User_talk:DragoonWraith|<span style="font-family: Oblivion; size=2;">TALK</span>]] 16:00, 27 August 2011 (EDT)

Revision as of 15:00, 27 August 2011

Velocity has to be applied every frame in order to work. I ran into a few problems trying to move Idle NPCs. It seems impossible to overcome the initial friction but moving them few units higher above where they are standing before trying to apply velocity should do the trick:

target.MoveTo target 0 0 5


Trigonometry is a must and calculating movement vectors with sin and cos:

Set cos to (source.GetPos x - target.GetPos x) / source.GetDistance target

Set sin to (source.GetPos y - target.GetPos y) / source.GetDistance target


Then multiply desired velocity on X with cos and Y with sin values to get target move from/to the source.

Another problem I ran into was that game seems to apply gravity before velocity so I had to find a constant value that I would apply to Z axis in order to negate initial gravity or target would fall to the ground and cease to move because of the friction. I did some testing there using GetLocalGravity and value was something like -515. I tried experimenting with different Z velocities values until I reach antiG state and I found a sweet spot around 24 and I came to a conclusion that its actually gravity which is expressed in game units converted to feet by multiplying with (21+1/3). So in order to get that antiG constant use:

Set antiG to (GetLocalGravity Z) / (21+1/3) * -1


I hope it helps. ;) Mitchalek 04:57, 17 August 2011 (EDT)

Useful stuff; the game can be really inconsistent about its conversion from feet to units and back (sometimes it seems to use just 21, other times 21.3333 with some arbitrary number of threes that seems to vary from place to place). Glad that you've fiddled with this; I'm going to mention the gravity thing on the page.
You are, by the way, welcome to update the page itself with these kinds of findings. I do recommend taking a look at Help:Editing for some pointers, though; italics aren't the best choice for code.
Also, please sign your comments in Discussion pages by ending with ~~~~; that will insert your username and a timestamp. Thanks!
Dragoon Wraith TALK 19:02, 13 August 2011 (EDT)

Underwater?

Is it true that this function has no effect at all while an actor is swimming or under water? I've been trying around a lot, but once you're in water, any effect seems to be ignored. The same seems to apply for SetLocalGravity. Please check also my post about this in the tesnexus forums here: [1].

jaime74 10:01, 27 August 2011 (EDT)

I suggest that you mention this in the OBSE thread on the official forums. To the best of my knowledge, it is the only place that anyone from the OBSE team checks regularly. That includes the Wish List.
Also, you can use ~~~~ to sign comments easily, rather than typing out your signature each time, which it appears you've maybe done?
Dragoon Wraith TALK 16:00, 27 August 2011 (EDT)