Jump to content

Rotating an object without breaking its animation?


simsam

Recommended Posts

Hello,

 

I'm trying to make some alternate controls for combat. Lock on a target and the player orients himself towards it.

I tried manyyyyyyyyy different functions, all resulting in some problem.

 

To boil it down my problem is that using player.setangleZ "teleports" the player to the new location, and breaks his animation (making him jiggly like a parkinsonian).

So instead of "setting" the orientation, I am looking for a way to apply a force to that object (angular velocity), so the havok engine takes care of smoothly interpolating the view to the desired angle.

 

I know this must sound like gibberish, so to put it plainly:

What is the best method to reorient the player's camera or body toward a certain angle?

Link to comment
Share on other sites

Thanks but i tried it already (as well as splinetranslateto and a couple of others).

For some reason the rotation part doesnt get applied on the player (it works on other objects/npcs). Seems like it gets overwritten by something...

I tried disabling playercontrols, but to no avail. Here's my update function, as you can see i tried all the functions I could find on creationkit.com.

But since im new to modding, i hope i just missed a chapter...

 

Event OnUpdate()

;trackcaster.StopTranslation()

 

float pX = trackcaster.GetPositionX()

float pY = trackcaster.GetPositionY()

float pZ = trackcaster.GetPositionZ()

float angleX = trackcaster.GetAngleX()

float angleY = trackcaster.GetAngleY()

float head = trackcaster.GetHeadingAngle(trackTarget)

float angleZ = trackcaster.GetAngleZ() + head

 

if math.Abs(head) > 0

; trackcaster.TranslateTo(pX,pY,pZ, angleX, angleY, angleZ,20,200)

trackcaster.SetAngle(angleX, angleY, angleZ)

; trackcaster.SplineTranslateTo(pX, pY, pZ,angleX,angleY,angleZ, 100, 100,100)

endif

 

;trackcaster.SetHeadTracking(true)

;trackcaster.SetLookAt(tracktarget,true)

 

RegisterForSingleUpdate(1)

endEvent

Edited by simsam
Link to comment
Share on other sites

I can't see why that would be breaking the character's animation. It also should definitely be changing the player's angle.

 

Have you tried putting a Debug.notification in your if math.Abs(head) > 0 conditional?

 

What about updating more often than once per second to make the movements smoother?

 

If this isn't any help, you could always take a look at the scripts in one of the sex mods; presumably they must be overcoming this issue somehow.

Link to comment
Share on other sites

For some reason the rotation part doesnt get applied on the player (it works on other objects/npcs). Seems like it gets overwritten by something...

The player is under mouse control, which probably overrides any scripted movement like this. I'm guessing that you would probably have to disable player controls for this to work.

Link to comment
Share on other sites

  • 2 weeks later...
  • Recently Browsing   0 members

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