- Home /
Pose.ctor - create pose from vector3 and quaternion
Hello! I am trying to create a new pose to place an AR Anchor. I have been using a raycast hit pose to place, but I am wanting to place it with a button click rather than a tap.
To do this, i am needing to create a new Pose from a Vector3 and quaternion. The manual (https://docs.unity3d.com/ScriptReference/Pose-ctor.html) states that Pose.ctor(Vector3,Quarternion)
can do this, but I am getting a error CS0117: 'Pose' does not contain a definition for 'ctor'
error
I am using:
Pose hitPose = Pose.ctor (placementIndicator.position, Quaternion.identity);
var anchor = m_AnchorManager.AddAnchor (hitPose);
Any help would be appreciated. Thanks! :-)
Answer by Bunny83 · Mar 13, 2020 at 11:28 AM
"ctor" is a special name for the "constructor" in .NET / IL. While technically there is a hidden method called "ctor", you can not call it manually. you have to use
Pose hitPose = new Pose(placementIndicator.position, Quaternion.identity);
I guess that the documentation was automatically created with a tool that scanned through the actual assembly file but they forgot to handle the constructor properly.
Great, thank you! And thanks for explaining why "ctor" doesn't work
Your answer
Follow this Question
Related Questions
How to add 2 Quaternions. 2 Answers
Vector3 and Quaternion issues. 2 Answers
Distribute terrain in zones 3 Answers
Object snapping to floor and other objects in VR 1 Answer
Quaternion.FromToRotation() 3D direction on 2 axes. 1 Answer