I’m having a strange problem when creating and reading spline points (or perhaps I’m mis-understanding how it’s supposed to work).
I’m dynamically adding SplineComponents to an Actor based on a generated Vector array (Points). The Vector array is in World coordinates (I confirmed this). I then Add SplineComponent (using AddSplineComponent Node) and use SetSplinePoints node to add the points from the Vector array to the spline. Later I read out the spline points and print them.
If I leave the “Manual Attachment” checkbox on AddSplineComponent un-checked, then it doesn’t seem to matter if I use “World” or “Local” setting in “Coordinate Space” when either setting or reading out the Points, the values always come out as relative to the Actor. If I check the checkbox, then it similarly doesn’t matter what setting I use in “Coordinate Space”, the values always come out as world coordinates.
The root component of my Actor is just a “DefaultSceneRoot”.
This is not the behavior I was expecting. I would appreciate a clarification on this. The relevant Blueprint code is below.
Hey,
So yeah the Manual Attachment is essentially skipping the automatic attachment to your actor if enabled. Therefore if you have this enabled it will add the component but it will default to World 0,0,0 and therefore when adding points you are seeing these in world space as it doesn’t have a local space as it isn’t attached. Whereas if you have this unchecked it will attach the new Component to your Actor and therefore you will see these relative to your Actor. I would in this scenario however expect the World/Local to make a difference but your not seeing this?
Yes, it’s strange, but I double-checked and if I leave the “Manual Attachment” checkbox un-checked then the coordinates reported by GetsplinePointAt are always local no matter if “Local” or “World” setting is used.
Is the actor your attaching to at World 0,0,0? If so then I would exepect Local and World to be the same
Alternatively is the function your using to get the location only returning Local?
Hi Jake,
No the actor is not at World 0,0,0. To get the coordinates I’m just using “GetSplinePointAt” and feeding the output to a PrintString, as seen in the image I posted. There’s no additional wrapper around it.
It seems to work ok for me if I keep “Manual Attachment” checked, but I still don’t understand the logic of its behavior.
-Mike.
Hey Mike,
So intersting looking at the code for that node the only reason the Coordinate Space is used is for the rotation. If you instead use GetLocationAtSplinePoint for the Location then that will correctly use the Coordinate Space.