Get underlying Bullet constraint

I would like to get hold of the underlying Bullet constraint (btTypedConstraint) from the Constraint-component, so that I can get access to the methods for controlling the motor.

The Constraint-class in Urho3D has this public method:
btTypedConstraint* GetConstraint() const { return constraint_.Get(); }

Would it be possible to add this to UrhoSharp, and then call the methods on btTypedConstraint?

Answers

  • EsaKEsaK SEMember ✭✭

    Actually it's the methods from btHingeConstraint (which is a subclass to btTypedConstraint) that are of interest for me.
    For example these methods:
    void enableAngularMotor(bool enableMotor,btScalar targetVelocity,btScalar maxMotorImpulse);
    void enableMotor(bool enableMotor);
    void setMaxMotorImpulse(btScalar maxMotorImpulse);
    void setMotorTarget(const btQuaternion& qAinB, btScalar dt);
    void setMotorTarget(btScalar targetAngle, btScalar dt);
    btScalar getHingeAngle();
    btScalar getHingeAngle(const btTransform& transA,const btTransform& transB);
    bool getAngularOnly();
    bool getEnableAngularMotor();
    btScalar getMotorTargetVelosity();
    btScalar getMaxMotorImpulse();

    But now I found another way to solve my problem (via setting the limit on the constraint).
    So I don't need those methods right now, but maybe in the future.
    It would still be interesting to see how those API's can be exposed to C#/UrhoSharp.

  • EgorBoEgorBo BYXamarin Team ✭✭✭

    @EsaK
    Sorry for delayed response, I'll create an issue in order to surface some Bullet API in UrhoSharp, currently all types starting with "bt" are ignored by the binding generator.

  • EsaKEsaK SEMember ✭✭

    Thanks @EgorBo, much appreciated!

  • MigueldeIcazaMigueldeIcaza USXamarin Team Xamurai

    Binding Bullet will be a large effort.

    My recommendation is to merely surface the low-level pointer for now, and let the users manually P/Invoke into the bullet API.

  • MigueldeIcazaMigueldeIcaza USXamarin Team Xamurai

    There is BulletSharp:

    https://github.com/AndresTraks/BulletSharp

    So perhaps all we need is to surface the pointer, and then you could create an instance of the proper Bullet type from the naked pointer and access the API that way.

  • MigueldeIcazaMigueldeIcaza USXamarin Team Xamurai

    My bad, BulletSharp uses C++/CLI which would not work anywhere but Windows, so that option is not really useful.

    My suggestion is that for all APIs that you need surfaced, you create a proper Urho-like object, with Urho-like properties, so the binding system gets them.

  • EsaKEsaK SEMember ✭✭

    @EgorBo

    Would it be possible to surface these methods from btHingeConstraint?
    btScalar getHingeAngle();
    btScalar getHingeAngle(const btTransform& transA,const btTransform& transB);

    ... or if you could give some guidance of how to do it, then I could give a shot at it?

Sign In or Register to comment.