Code Monkey home page Code Monkey logo

Comments (4)

Zelyutin avatar Zelyutin commented on July 28, 2024 1

Thank you very much for you rapid and detailed answer! It helped!

from bulletsharp.

AndresTraks avatar AndresTraks commented on July 28, 2024

It depends on the version of BulletSharp, but it's usually a class called Matrix.

Your IDE should suggest the right type when you type in:

colMapObject = new CompoundShape()
colMapObject.AddChildShape(

from bulletsharp.

Zelyutin avatar Zelyutin commented on July 28, 2024

Yeah, I know that the Matrix should be passed as an argument. I use bullet sharp 3 and VS2017. But I didn't found a method in Matrix that will create it from Quaternion and Vector3 as in original btTransform. That's why I asked it.

from bulletsharp.

AndresTraks avatar AndresTraks commented on July 28, 2024

I mean it depends on whether it's the generic version or a version that uses types from a graphics library like OpenTK/SharpDX/etc.

The generic version has no special Matrix constructors, but you can always multiply a rotation matrix and a translation matrix.

Matrix rotation = Matrix.RotationQuaternion(new Quaternion(0, 0, 0, 1));
Matrix translation = Matrix.Translation(x, y, z);
Matrix transform = rotation * translation;
colMapObject.AddChildShape(transform, sphere);

See here about multiplying matrices:
https://docs.microsoft.com/en-us/windows/desktop/direct3d9/transforms#concatenating-matrices
With a Matrix class from some other framework, you can do the same, except if the matrix layout is different (like in OpenTK), you may have to reverse the multiplication order to translation * rotation.

In this particular case, since (0, 0, 0, 1) is an identity quaternion that specifies no rotation, you could just use the translation matrix: colMapObject.AddChildShape(Matrix.Translation(x, y, z), sphere);

The generic version of BulletSharp has math classes based on SlimDX:
https://slimdx.org/docs/#T_SlimDX_Matrix
However, the Matrix.Transformation constructor that takes a rotation quaternion and a translation vector has been removed since it depends on DirectX.

from bulletsharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.