当前位置: 首页>>代码示例>>C++>>正文


C++ ToB2Vec2函数代码示例

本文整理汇总了C++中ToB2Vec2函数的典型用法代码示例。如果您正苦于以下问题:C++ ToB2Vec2函数的具体用法?C++ ToB2Vec2怎么用?C++ ToB2Vec2使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ToB2Vec2函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ReleaseFixture

void CollisionEdge2D::RecreateFixture()
{
    ReleaseFixture();

    Vector2 worldScale(cachedWorldScale_.x_, cachedWorldScale_.y_);
    edgeShape_.Set(ToB2Vec2(vertex1_ * worldScale), ToB2Vec2(vertex2_ * worldScale));

    CreateFixture();
}
开发者ID:dreamsxin,项目名称:Urho3D,代码行数:9,代码来源:CollisionEdge2D.cpp

示例2: ToB2Vec2

b2JointDef* ConstraintDistance2D::GetJointDef()
{
    if (!ownerBody_ || !otherBody_)
        return 0;

    b2Body* bodyA = ownerBody_->GetBody();
    b2Body* bodyB = otherBody_->GetBody();
    if (!bodyA || !bodyB)
        return 0;

    jointDef_.Initialize(bodyA, bodyB, ToB2Vec2(ownerBodyAnchor_), ToB2Vec2(otherBodyAnchor_));

    return &jointDef_;
}
开发者ID:Boshin,项目名称:Urho3D,代码行数:14,代码来源:ConstraintDistance2D.cpp

示例3: ToB2Vec2

b2JointDef* ConstraintWheel2D::GetJointDef()
{
    if (!ownerBody_ || !otherBody_)
        return nullptr;

    b2Body* bodyA = ownerBody_->GetBody();
    b2Body* bodyB = otherBody_->GetBody();
    if (!bodyA || !bodyB)
        return nullptr;
    
    jointDef_.Initialize(bodyA, bodyB, ToB2Vec2(anchor_), ToB2Vec2(axis_));

    return &jointDef_;
}
开发者ID:nemerle,项目名称:lutefisk3d,代码行数:14,代码来源:ConstraintWheel2D.cpp

示例4: ToB2Vec2

void RigidBody2D::CreateBody()
{
    if (body_)
        return;

    if (!physicsWorld_ || !physicsWorld_->GetWorld())
        return;

    bodyDef_.position = ToB2Vec2(node_->GetWorldPosition());;
    bodyDef_.angle = node_->GetWorldRotation().RollAngle() * M_DEGTORAD;

    body_ = physicsWorld_->GetWorld()->CreateBody(&bodyDef_);
    body_->SetUserData(this);

    for (unsigned i = 0; i < collisionShapes_.Size(); ++i)
    {
        if (collisionShapes_[i])
            collisionShapes_[i]->CreateFixture();
    }

    if (!useFixtureMass_)
        body_->SetMassData(&massData_);
    
    for (unsigned i = 0; i < constraints_.Size(); ++i)
    {
            if (constraints_[i])
            constraints_[i]->CreateJoint();
    }
}
开发者ID:3dicc,项目名称:Urho3D,代码行数:29,代码来源:RigidBody2D.cpp

示例5: InitializeJointDef

b2JointDef* ConstraintRope2D::CreateJointDef()
{
    if (!ownerBody_ || !otherBody_)
        return 0;

    b2Body* bodyA = ownerBody_->GetBody();
    b2Body* bodyB = otherBody_->GetBody();
    if (!bodyA || !bodyB)
        return 0;

    b2RopeJointDef* jointDef = new b2RopeJointDef;
    InitializeJointDef(jointDef);

    jointDef->localAnchorA = ToB2Vec2(ownerBodyAnchor_);
    jointDef->localAnchorB = ToB2Vec2(otherBodyAnchor_);
    jointDef->maxLength = maxLength_;

    return jointDef;
}
开发者ID:Gotusso,项目名称:Urho3D,代码行数:19,代码来源:ConstraintRope2D.cpp

示例6: ReleaseFixture

void CollisionCircle2D::RecreateFixture()
{
    ReleaseFixture();

    // Only use scale in x axis for circle
    float worldScale = cachedWorldScale_.x_;
    circleShape_.m_radius = radius_ * worldScale;
    circleShape_.m_p = ToB2Vec2(center_ * worldScale);

    CreateFixture();
}
开发者ID:AliAkbarMontazeri,项目名称:AtomicGameEngine,代码行数:11,代码来源:CollisionCircle2D.cpp

示例7: RecreateJoint

void ConstraintMotor2D::SetLinearOffset(const Vector2& linearOffset)
{
    if (linearOffset == linearOffset_)
        return;

    linearOffset_ = linearOffset;

    if (joint_)
        static_cast<b2MotorJoint*>(joint_)->SetLinearOffset(ToB2Vec2(linearOffset));
    else
        RecreateJoint();

    MarkNetworkUpdate();
}
开发者ID:1vanK,项目名称:Urho3D,代码行数:14,代码来源:ConstraintMotor2D.cpp

示例8: RecreateJoint

void ConstraintMouse2D::SetTarget(const Vector2& target)
{
    if (target == target_)
        return;

    target_ = target;

    if (joint_)
        static_cast<b2MouseJoint*>(joint_)->SetTarget(ToB2Vec2(target));
    else
        RecreateJoint();

    MarkNetworkUpdate();
}
开发者ID:tungsteen,项目名称:Urho3D,代码行数:14,代码来源:ConstraintMouse2D.cpp

示例9: ToB2Vec2

b2JointDef* ConstraintMotor2D::GetJointDef()
{
    if (!ownerBody_ || !otherBody_)
        return nullptr;

    b2Body* bodyA = ownerBody_->GetBody();
    b2Body* bodyB = otherBody_->GetBody();
    if (!bodyA || !bodyB)
        return nullptr;

    jointDef_.Initialize(bodyA, bodyB);
    jointDef_.linearOffset = ToB2Vec2(linearOffset_);

    return &jointDef_;
}
开发者ID:1vanK,项目名称:Urho3D,代码行数:15,代码来源:ConstraintMotor2D.cpp

示例10: ReleaseFixture

void CollisionBox2D::RecreateFixture()
{
    ReleaseFixture();

    float worlsScaleX = cachedWorldScale_.x_;
    float worldScaleY = cachedWorldScale_.y_;
    float halfWidth = size_.x_ * 0.5f * worlsScaleX;
    float halfHeight = size_.y_ * 0.5f * worldScaleY;
    Vector2 scaledCenter = center_ * Vector2(worlsScaleX, worldScaleY);

    if (scaledCenter == Vector2::ZERO && angle_ == 0.0f)
        boxShape_.SetAsBox(halfWidth, halfHeight);
    else
        boxShape_.SetAsBox(halfWidth, halfHeight, ToB2Vec2(scaledCenter), angle_ * M_DEGTORAD);

    CreateFixture();
}
开发者ID:Boshin,项目名称:Urho3D,代码行数:17,代码来源:CollisionBox2D.cpp

示例11: ToB2Vec2

b2JointDef* ConstraintMouse2D::GetJointDef()
{
    if (!ownerBody_ || !otherBody_)
        return nullptr;

    b2Body* bodyA = otherBody_->GetBody();
    b2Body* bodyB = ownerBody_->GetBody();
    if (!bodyA || !bodyB)
        return nullptr;

    jointDef_.bodyA = bodyA;
    jointDef_.bodyB = bodyB;
    jointDef_.collideConnected = collideConnected_;

    jointDef_.target = ToB2Vec2(target_);

    return &jointDef_;
}
开发者ID:tungsteen,项目名称:Urho3D,代码行数:18,代码来源:ConstraintMouse2D.cpp

示例12: ReleaseFixture

void CollisionPolygon2D::RecreateFixture()
{
    ReleaseFixture();
    
    if (vertices_.Size() < 3)
        return;

    PODVector<b2Vec2> b2Vertices;
    unsigned count = vertices_.Size();
    b2Vertices.Resize(count);

    Vector2 worldScale(cachedWorldScale_.x_, cachedWorldScale_.y_);
    for (unsigned i = 0; i < count; ++i)
        b2Vertices[i] = ToB2Vec2(vertices_[i] * worldScale);

    polygonShape_.Set(&b2Vertices[0], count);

    CreateFixture();
}
开发者ID:Boshin,项目名称:Urho3D,代码行数:19,代码来源:CollisionPolygon2D.cpp

示例13: ReleaseFixture

void CollisionChain2D::RecreateFixture()
{
    ReleaseFixture();

    PODVector<b2Vec2> b2Vertices;
    unsigned count = vertices_.Size();
    b2Vertices.Resize(count);

    Vector2 worldScale(cachedWorldScale_.x_, cachedWorldScale_.y_);
    for (unsigned i = 0; i < count; ++i)
        b2Vertices[i] = ToB2Vec2(vertices_[i] * worldScale);

    if (loop_)
        chainShape_.CreateLoop(&b2Vertices[0], count);
    else
        chainShape_.CreateChain(&b2Vertices[0], count);

    CreateFixture();
}
开发者ID:dreamsxin,项目名称:Urho3D,代码行数:19,代码来源:CollisionChain2D.cpp

示例14: ReleaseFixture

void CollisionChain2D::RecreateFixture()
{
    ReleaseFixture();

    std::vector<b2Vec2> b2Vertices;
    size_t count = vertices_.size();
    b2Vertices.resize(count);

    Vector2 worldScale(cachedWorldScale_.x_, cachedWorldScale_.y_);
    for (size_t i = 0; i < count; ++i)
        b2Vertices[i] = ToB2Vec2(vertices_[i] * worldScale);

    chainShape_.Clear();
    if (loop_)
        chainShape_.CreateLoop(&b2Vertices[0], count);
    else
        chainShape_.CreateChain(&b2Vertices[0], count);

    CreateFixture();
}
开发者ID:nemerle,项目名称:lutefisk3d,代码行数:20,代码来源:CollisionChain2D.cpp

示例15: MarkNetworkUpdate

void ConstraintMouse2D::SetTarget(const Vector2& target)
{
    if (target == target_)
        return;

    target_ = target;
    if (joint_ && targetSetted_)
    {
        b2MouseJoint* mouseJoint = (b2MouseJoint*)joint_;
        mouseJoint->SetTarget(ToB2Vec2(target_));

        MarkNetworkUpdate();
        return;
    }

    targetSetted_ = true;

    RecreateJoint();
    MarkNetworkUpdate();
}
开发者ID:nonconforme,项目名称:Urho3D,代码行数:20,代码来源:ConstraintMouse2D.cpp


注:本文中的ToB2Vec2函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。