本文整理汇总了C++中Object3D::absoluteTransformation方法的典型用法代码示例。如果您正苦于以下问题:C++ Object3D::absoluteTransformation方法的具体用法?C++ Object3D::absoluteTransformation怎么用?C++ Object3D::absoluteTransformation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object3D
的用法示例。
在下文中一共展示了Object3D::absoluteTransformation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mousePressEvent
void BulletExample::mousePressEvent(MouseEvent& event) {
/* Shoot an object on click */
if(event.button() == MouseEvent::Button::Left) {
const Vector2 clickPoint = Vector2::yScale(-1.0f)*(Vector2{event.position()}/Vector2{GL::defaultFramebuffer.viewport().size()} - Vector2{0.5f})* _camera->projectionSize();
const Vector3 direction = (_cameraObject->absoluteTransformation().rotationScaling()*Vector3{clickPoint, -1.0f}).normalized();
auto* object = new RigidBody{
&_scene,
_shootBox ? 1.0f : 5.0f,
_shootBox ? static_cast<btCollisionShape*>(&_bBoxShape) : &_bSphereShape,
_bWorld};
object->translate(_cameraObject->absoluteTransformation().translation());
/* Has to be done explicitly after the translate() above, as Magnum ->
Bullet updates are implicitly done only for kinematic bodies */
object->syncPose();
/* Create either a box or a sphere */
new ColoredDrawable{*object, _shader, _shootBox ? _box : _sphere,
_shootBox ? 0x880000_rgbf : 0x220000_rgbf,
Matrix4::scaling(Vector3{_shootBox ? 0.5f : 0.25f}), _drawables};
/* Give it an initial velocity */
object->rigidBody().setLinearVelocity(btVector3{direction*25.f});
event.setAccepted();
}
}