Jump to content

SplineTranslateTo() Help. What is meant by Magnitude of the spline tangents?


cypher2012

Recommended Posts

Hey guys, please can somebody advise me about what is meant about 'Magnitude of the spline tangents'?

 

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

 

"afTangentMagnitude: Magnitude of the spline tangents"

SplineTranslateTo(arTarget.X,
arTarget.Y, 
arTarget.Z, 
arTarget.GetAngleX(), 
arTarget.GetAngleY(), 
arTarget.GetAngleZ(), 
afTangentMagnitude,  ;What is this?!
afSpeed, 
afMaxRotationSpeed)
Link to comment
Share on other sites

I think I finally figured it out. I think it's meant to be the distance over which the object makes the rotation.

 

I was experimenting with having two points, and wanted the object to make a perfect curve from one point to the next.

 

The following code seems to work. It simply calculates the distance between the two points:

Event OnActivate(ObjectReference akActionRef)
	Float fTestDistance = start_marker.GetDistance(end_marker)
	object_to_move.SplineTranslateTo(end_marker.X, end_marker.Y,end_marker.Z, end_marker.GetAngleX(), end_marker.GetAngleY(), end_marker.GetAngleZ(), fTestDistance, 100.0)
EndEvent
Edited by cypher2012
Link to comment
Share on other sites

I think I finally figured it out. I think it's meant to be the distance over which the object makes the rotation.

 

I was experimenting with having two points, and wanted the object to make a perfect curve from one point to the next.

 

The following code seems to work. It simply calculates the distance between the two points:

Event OnActivate(ObjectReference akActionRef)
	Float fTestDistance = start_marker.GetDistance(end_marker)
	object_to_move.SplineTranslateTo(end_marker.X, end_marker.Y,end_marker.Z, end_marker.GetAngleX(), end_marker.GetAngleY(), end_marker.GetAngleZ(), fTestDistance, 100.0)
EndEvent

I use spline translations a lot in my skyBirds mod for Skyrim. I found that 100 was a good all-round value to use regardless of the distance travelled. Cheers.

 

Edit: I used the following formulas for fTestDistance:

 

if goal.X != self.X

dist = math.Sqrt(math.Pow(self.X - goal.X, 2 as Float) + math.Pow(self.Y - goal.Y, 2 as Float))

 

else

 

dist = math.Abs(self.Y - goal.Y)

 

But I forget why I did it that way. The first formula looks like Pythagoras' rule for the length of the hypotenuse, so it would be the distance between the object and the target. Cheers.

Edited by steve40
Link to comment
Share on other sites

  • Recently Browsing   0 members

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