Forcing Collision but making Mass to Unmovable


Is there a way to make something collidable but not movable. For example a wall.


So does the floor, doesn’t it?

Not sure how to respond. It’s late and tired so it’s working. I have some quick run through video prob in my morning.

You probably figured it out already, but a Rigidbody with mass 0 (static mode) combined with a CollisionShape creates an unmovable colliding object. This can be a triangle mesh shape too (unlike moving objects that cannot be triangle meshes reliably).

Yup. I’m just figuring out the best collision setup. MakeHuman places origins at the base of a skeleton which I think should be centered. So to use a good bound setup I will have to test the dimensions of a mesh and offset collision bound to the center.

I would love to use convex hull but I have to make a mechanism to reorient itself based on collision areas, gravity, free fall and health. As to camera points for first person view I might use a xml to store mesh attachnent point coordinates.


The video is at … 7uTgUBQjaw


Is this correct to get a static point center and use it for making the colliding area? I mean to use the bounding box center to set the offset? It seems to be almost accurate.


// character class
void ExistenceClient::CreateCharacter(void)
    // get resources
    ResourceCache* cache = GetSubsystem<ResourceCache>();
    Renderer* renderer = GetSubsystem<Renderer>();
    Graphics* graphics = GetSubsystem<Graphics>();
    UI* ui = GetSubsystem<UI>();
    FileSystem * filesystem = GetSubsystem<FileSystem>();

    //String characternode = String("Character");

    Node* objectNode = scene_->GetChild("Character");

    // Create rigidbody, and set non-zero mass so that the body becomes dynamic
    RigidBody* body = objectNode->CreateComponent<RigidBody>();

    StaticModel * staticmodelreference = objectNode->GetComponent<StaticModel>();
    Model * staticmodel=staticmodelreference->GetModel();

    BoundingBox   staticmodelbox = staticmodel->GetBoundingBox();
    Vector3  staticmodelboxcenter= Vector3(staticmodelbox.max_-staticmodelbox.min_)/2;

    // Set zero angular factor so that physics doesn't turn the character on its own.
    // Instead we will control the character yaw manually

    // Set the rigidbody to signal collision also when in rest, so that we get ground collisions properly

    // Set a capsule shape for collision
    CollisionShape* shape = objectNode->CreateComponent<CollisionShape>();

    character_ = objectNode->CreateComponent<Character>();

    // Create a scene node for the camera, which we will move around
    // The camera will use default settings (1000 far clip distance, 45 degrees FOV, set aspect ratio automatically)
    Node * cameraNode_ = objectNode ->CreateChild("CameraFirstPerson");

    // Set an initial position for the camera scene node above the plane

    Camera* cameraObject = cameraNode_->CreateComponent<Camera>();


    // Set up a viewport to the Renderer subsystem so that the 3D scene can be seen. We need to define the scene and the camera
    // at minimum. Additionally we could configure the viewport screen size and the rendering path (eg. forward / deferred) to
    // use, but now we just use full screen and default render path configured	SetOrthographic ( in the engine command line options
    //viewport -> SetCamera(cameraObject);

    SharedPtr<Viewport> viewport(new Viewport(context_, scene_, cameraObject));
    renderer->SetViewport(0, viewport);


Yes, if you want the collision capsule to be centered on the visible mesh’s bounding box, then that’s correct. You could also use the Center() member function of BoundingBox.

I’ll probably use that in a rewrite. The way I did it I realized is a line or two longer but I learned some of the inner workings this way at the same time.

The next feat is either the terrain texture or perlin generated height map.