-
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "set_bone_position" API method #124
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Looks good.
Some changes needed.
Q: What is the benefit of this function over functions like set_ik_target_position
and set_ik_target
?
@@ -1396,6 +1396,24 @@ namespace dmSpine | |||
*instance_id = dmGameObject::GetIdentifier(bone_instance); | |||
return true; | |||
} | |||
|
|||
bool CompSpineModelSetBonePosition(SpineModelComponent* component, dmhash_t bone_name, Point3 position) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our code code convention here is const dmVMath::Point3& position)
@@ -97,6 +97,8 @@ namespace dmSpine | |||
|
|||
bool CompSpineModelGetBone(SpineModelComponent* component, dmhash_t bone_name, dmhash_t* instance_id); | |||
|
|||
bool CompSpineModelSetBonePosition(SpineModelComponent* component, dmhash_t bone_name, Vectormath::Aos::Point3 position); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The correct type is const dmVMath::Point3&
@@ -679,6 +679,47 @@ namespace dmSpine | |||
return 0; | |||
} | |||
|
|||
/*# Set world space bone position | |||
* Note that bones positions will be overwritten by active animations and constraints(IK, Path, Transform...), only change positions of bones that is not affected by those. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct tag for notes is @note
@@ -780,6 +821,7 @@ namespace dmSpine | |||
{"set_ik_target_position", SpineComp_SetIKTargetPosition}, | |||
{"set_ik_target", SpineComp_SetIKTarget}, | |||
{"reset_ik_target", SpineComp_ResetIK}, | |||
{"set_bone_position", SpineComp_SetBonePosition}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our api, we use "world" in the names (See go.get_world_position())
This function should be called set_world_bone_position()
.
That, or make it accept local space coordinate.
dmhash_t bone_id = dmScript::CheckHashOrString(L, 2); | ||
Vectormath::Aos::Vector3* position = dmScript::CheckVector3(L, 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only do casts if we know it's the correct type.
Here, they're not the same: Vector3 != Point3
You can create a Point3 like so: Point3(v3)
@ProtonGustave any chance you will look into the PR feedback? Or should we close this PR due to inactivity? |
Add "set_bone_position" method to directly change bones positions. Will be useful for procedural animations and constraint targets.