MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / SetWorldPosition

Method SetWorldPosition

include/RavEngine/Transform.hpp:149–161  ·  view source on GitHub ↗

Move this transform to a new location in world space @param newPos the new position in world space. */

Source from the content-addressed store, hash-verified

147 @param newPos the new position in world space.
148 */
149 inline void Transform::SetWorldPosition(const vector3& newPos) {
150 if (!HasParent()) {
151 SetLocalPosition(newPos);
152 }
153 else {
154 //get the world position
155 auto worldpos = GetWorldPosition();
156 //get the displacement to the new world coords from the current local position
157 auto displacement = newPos - worldpos;
158 //update the local pos to that displacement
159 LocalTranslateDelta(displacement);
160 }
161 }
162
163 /**
164 Overwrite the rotation of this transform in local (parent) space.

Callers 2

ResetCamMethod · 0.80
TickMethod · 0.80

Calls

no outgoing calls

Tested by 1

ResetCamMethod · 0.64