Jump to content

In-Place Rotation with TranslateTo


niston

Recommended Posts

Im doing this to slowly rotate a MovableStatic in place. So, only AngleZ is changing:

TranslateTo(fPositionX, fPositionY, fPositionZ, fAngleX, fAngleY, fTargetAngleZOpen, RotationSpeed, RotationSpeed)

It works (the MovableStatic rotates to the desired angle), but the rotation happens instantly. Even though I have set the afMaxRotationSpeed parameter to 0.2, so I would expect it to rotate with 0.2 degrees per second maximum angular velocity, as per https://www.creationkit.com/index.php?title=TranslateTo_-_ObjectReference.

 

Why does this not work as expected?

Link to comment
Share on other sites

So, it's getting weirder and weirder....

 

When I use exactly this on my MovableStatic:

TranslateTo(-58816.000000, -11320.000000, 1408.000000, 0.000000, 0.000000, 178.854187, 0.0, 2.000000)

Then it takes quite some time until the OnTranslationComplete Event is fired. As if the object would be moving.... However, the MovableStatic doesn't actually move one iota. Until just before the OnTranslationComplete event occurs, that is. The MovableStatic will then instantly rotate to the destination angle. So, instead of rotating smoothly, the MovableStatic just teleports between angles as if I had used Wait(sometime) and then SetAngle(blah).

 

This is exactly the issue that was mentioned in https://forums.nexusmods.com/index.php?/topic/6564401-papyrus-local-rotation/?p=59298986

 

 


2. You can't translate a Static object fluently, it teleports because of that. To translate something as intended, that object must have collisions updatable by havok. In other words, it should be MovableStatic or MiscObject. First thing to try is create a new MovableStatic and past the path to nif from this Static. Without editing nif file itself.

 

Except that I am indeed using a MovableStatic which I have created exactly as described above, by getting the NIF from a Static and putting it into a newly created MovableStatic. But I'm getting behaviour from TranslateTo() as if I had used it with a Static.

 

WTF is going on here...

 

Would I be better off writing a timer/setangle based solution perhaps? Altho I wanted to avoid that, and it completely and totally escapes me why in the f*** I should even have to mess about.

Link to comment
Share on other sites

Hello niston,

 

What you want to use is RotationHelperFree. Good thing about using RotationHelperFree is that the collision stays intact and moves along with the mesh.

 

You can see the example of how it is used in Big John's Salvage cell. The gate makes use of this, and you'll find a script example there. Mass State House has some examples of it used to tilt or break floors.

Edited by DiodeLadder
Link to comment
Share on other sites

Hi, thanks for your reply.

 

I got it to work. For future reference, one essential piece of information was missing:

 

https://www.creationkit.com/index.php?title=SetMotionType_-_ObjectReference

 

Programmer needs to SetMotionType(Motion_Keyframed) on the MovableStatics, or it won't work!

 

Will look into the RotationHelperFree anyways. Thanks again :D

 

NB: If using a MovableStatic, the collision box will move along, too. For example, https://www.youtube.com/watch?v=9k68AhAtcYQ you can walk or stand on the gates while they are moving and you won't fall off.

Link to comment
Share on other sites

And there's even a third option which is attaching the object to a helper and calling TranslateTo on the helper instead of the actual object, using this method you don't need to use SetMotionType(Motion_Keyframed).

I discovered it because I was creating a boat that has some activators attached so I can control the boat using TranslateTo, which is called from the activators, since the boat and the activators are all attached to the helper what I actually translate is the helper, a floating helper, which applies the wave movement to the attached references. None of the attached references nor the helper need SetMotionType(Motion_Keyframed).

 

Edited by DieFeM
Link to comment
Share on other sites

Interesting proposition.

 

If I had a trigger box/volume somewhere, could I somehow get all FloatingPlatformHelpers that are inside the volume? Wondering if this could be used to make boats inside the water lock (from the video linked above) float up when flooding the lock, etc.

 

How do they even work? I looked at one of them briefly but couldnt make much sense of it. Are they some sort of native object, or are they scripted things as well? Google shows literally a single, somewhat useful hit at the nexus, when trying "FloatingPlatformHelper" as a search term.

Link to comment
Share on other sites

In the case of the floating platform helper you only need to attach the object to the helper by scripts or in the reference properties, for other helpers might be different, for example for the elevator helper you need to call PlayAnimation on the helper in order to start the movement. I just check references already used in game to deduce how they work.

Link to comment
Share on other sites

Ah, I meant more like, how are they implemented. Didn't find a script for them and the ones in game sure do not have a script attached either, so I take it they are native objects.

 

But... you're working on a driveable boat mod? Now that is just perfect! How could we integrate your boat with my functional water lock (WIP) in Ragoda's "Sluice of Heaven" settlement? Because I was thinking "how cool would it be if you could drive a boat through the water lock and switch the lock right from the boat by remote control?"

Link to comment
Share on other sites

You put the helper and the object (or objects) that is going to be animated by the helper in the world, then right click on the object (in the render window) and click edit, there's a tab to set an attached ref, you need to attach the object (or objects) to the helper.

 

Or if you want to attach them to the helper by script you can use the function AttachRef, or PlaceAtNode with abAttach set to true, note that AttachRef will attach the object to the helper at the current position, but PlaceAtNode places a new reference that is moved to helper node that you set and then attaches it to the helper. I've customized a bit the floating helper model in NifSkope to add some nodes where I attach the activators with PlaceAtNode.

 

image.png

 

Example:

ObjectReference CreatedRef = HelperRef.PlaceAtNode(asNodeName = "DirectionSwitch", akFormToPlace = SwitchBaseObject, abAttach = true)

Edited by DieFeM
Link to comment
Share on other sites

Ah, I meant more like, how are they implemented. Didn't find a script for them and the ones in game sure do not have a script attached either, so I take it they are native objects.

 

But... you're working on a driveable boat mod? Now that is just perfect! How could we integrate your boat with my functional water lock (WIP) in Ragoda's "Sluice of Heaven" settlement? Because I was thinking "how cool would it be if you could drive a boat through the water lock and switch the lock right from the boat by remote control?"

 

Ha, the reason why I looked into RotateHelperFree was I was trying to animate the water lock doors myself, lol, as I am using them in a dungeon in a project I am working on. :-)

 

Kind of off topic, but I suppose the SetMotionType thing would smooth out the steppy collision translation of movable water? That is the only thing annoys me about movable water at the moment.

 

The advantage of "helper" bunch is that things don't have to be movable static. For example, at the end of Sentinel Site, you have the quarry elevator with an end-of-dungeon loot container on it. The container is attached to the platformhelperfree01 in this case. The Libertalia cells have a bunch of boats with floatingplatformhelperl, and they have containers and activators moving along with the helper. The lift connecting to the central location of Libertalia is using splines, too, which I don't think normally work with translateto.

 

 

DieFeM, your project looks awesome. :thumbsup: Thanks for sharing!!

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...