190 if (this->ParentAxisVisual())
192 this->ParentAxisVisual()->PreRender();
195 if (this->dirtyJointType)
197 this->UpdateAxis(this->axis, this->useParentFrame);
198 this->UpdateParentAxis(this->parentAxis,
199 this->parentAxisUseParentFrame);
201 this->dirtyJointType =
false;
207 this->dirtyAxis =
false;
210 if (this->dirtyParentAxis)
212 this->CreateParentAxis();
213 this->dirtyParentAxis =
false;
216 if (this->updateAxis)
219 !this->UpdateAxis(this->axis, this->useParentFrame);
222 if (this->updateParentAxis)
224 this->updateParentAxis =
225 !this->UpdateParentAxis(this->parentAxis,
226 this->parentAxisUseParentFrame);
245 if (this->arrowVisual !=
nullptr)
247 this->arrowVisual->Destroy();
248 this->arrowVisual.reset();
251 if (this->axisVisual !=
nullptr)
253 this->axisVisual->Destroy();
254 this->axisVisual.reset();
257 if (this->parentAxisVis !=
nullptr)
259 this->parentAxisVis->Destroy();
260 this->parentAxisVis.reset();
263 this->dirtyJointType =
false;
264 this->dirtyAxis =
false;
265 this->dirtyParentAxis =
false;
285 if (this->arrowVisual)
287 this->arrowVisual->Destroy();
288 this->arrowVisual.reset();
292 this->arrowVisual->SetMaterial(
"Default/TransYellow");
293 this->arrowVisual->SetLocalPosition(0, 0, 0);
294 this->arrowVisual->SetLocalRotation(0, 0, 0);
295 this->AddChild(this->arrowVisual);
297 this->updateAxis =
true;
298 this->ScaleToChild();
327 auto jointParentVis = this->
Scene()->
NodeByName(this->jointParentName);
328 if (jointParentVis ==
nullptr)
330 gzlog <<
"Joint parent with name " << this->jointParentName
332 <<
" so the parent axis will not be shown\n";
336 if (this->parentAxisVis)
338 this->parentAxisVis->Destroy();
339 this->parentAxisVis.reset();
343 jointParentVis->AddChild(this->parentAxisVis);
344 this->parentAxisVis->SetType(this->Type());
345 this->parentAxisVis->SetAxis(this->parentAxis,
346 this->parentAxisUseParentFrame);
348 this->updateParentAxis =
true;
349 this->ScaleToChild();
388 bool _useParentFrame)
394 double cosTheta = v.
Dot(u);
395 double angle = acos(cosTheta);
402 _arrowVisual->SetLocalRotation(quat);
407 this->Parent()->InitialLocalPose();
411 (parentInitPose * this->LocalPose()).Rot();
415 _arrowVisual->SetLocalRotation(quatFromModel.
Inverse() *
416 _arrowVisual->LocalRotation());
419 _arrowVisual->ShowArrowRotation(
425 if (this->axisVisual)
426 _arrowVisual->SetVisible(
true);
435 auto axisWorldRotation = _arrowVisual->WorldPose().Rot();
436 auto jointWorldRotation = this->WorldPose().Rot();
438 this->axisVisual->ShowAxisHead(
true);
439 _arrowVisual->ShowArrowShaft(
true);
444 this->axisVisual->ShowAxisHead(0,
false);
445 _arrowVisual->ShowArrowShaft(
false);
447 else if (axisWorld ==
450 this->axisVisual->ShowAxisHead(1,
false);
451 _arrowVisual->ShowArrowShaft(
false);
453 else if (axisWorld ==
456 this->axisVisual->ShowAxisHead(2,
false);
457 _arrowVisual->ShowArrowShaft(
false);