Plaforming with kinematic character controller

Repo posted - https://github.com/Lumak/Urho3D-KinematicCharacterController

This was the last item on my to-do-list related to Bullet Physics implementation for Urho3D, something I wanted to complete for a while and finally done, yay!

18 Likes

Glad to see you coming back with more amazing features!

1 Like

That looks awesome! Would love to see some ledge-grabbing action there.

repo created. post if you encounter any problem.

seconded, adding ledge-grab (and maybe climb for small objects) would make this a practically usable model out-of-the-box.

Depending on the use case, it already is.

Awesome demo .
Do you plan to submit a P.R. ?

Besides the changes in PhysicsWorld.h and PhysicsWorld.cpp

I did several modifications to make it work on the latest branch .

1-
In playGroundTest.xml , changed the hash from “3025579211” to “1301124395”

`<node id="34">`
    <attribute name="Variables">
				<variant hash="1301124395" type="Bool" value="true" />
	</attribute>
</node>

2 - Added at the end of the function :

void MovingPlatform::Initialize(Node *platformNode, const Vector3 &finishPosition, bool updateBodyOnPlatform)
{
....
....
      platformVolumdNode_->SetVar(StringHash("IsMovingPlatform"), true);
}

Did the hashing function change since 1.7?

Looks like it did

Current => Case sensitive hashing

unsigned StringHash::Calculate(const char* str, unsigned hash)
{
    if (!str)
        return hash;

    while (*str)
    {
        hash = SDBMHash(hash, (unsigned char)*str++);
    }

    return hash;
}  

1.7 => case insensitive hashing ,tolower(c)

    unsigned StringHash::Calculate(const char* str)
    {
        unsigned hash = 0;

        if (!str)
            return hash;

        while (*str)
        {
            // Perform the actual hashing as case-insensitive
            char c = *str;
            hash = SDBMHash(hash, (unsigned char)tolower(c));
            ++str;
        }

        return hash;
    }

Ok, thanks for the info.
I am done with my work on the kinematic char controller platforming and have moved onto another project on my to-do list. You are more than welcome to submit a PR of that work as if it was your own, or enhance it, or whatever you desire.

4 Likes

@Lumak Really nice work, as usual :+1:

@Lumak Great job. I have seen some of your other work. You are great with the physics API.

Woooo, look at the robot go down the ramp without bouncing all over the place! That feature alone makes this incredibly useful, and it honestly should be part of the core Urho3D package…

In truth, this is too useful. I’ve been working on a small personal project which is a platformer, and the difference between this kinematic controller and a “normal” character controller is like night and day. But this is all C++ code, and my project mainly uses Lua scripts…

I’ve been trying to port this controller to Lua myself but I’m having terrible luck with it. I even tried including the component inside the executable and then calling it within the scripts, but that didn’t work either :frowning: . So I wanted to ask if anyone else has managed to successfully incorporate this kinematic controller in a Lua project?