Loading video...

Video Failed to Load

Go Home

🕹️ Preparing a brand new BVH-based character controller which is lightweight, flexible, and requires no physics engine. 🍻 Big thanks to Garrett Johnson for his incredible three-mesh-bvh library that made all this possible. #threejs #threejsJourney #webdev #gamedev #r3f #ecctrl

24 Comments

Bruno Simon's profile picture
Bruno Simon1 year ago

@garrettkjohnson That final view with all the rooms and a good frame rate 🔥

Andrew Chen's profile picture
Andrew Chen1 year ago

@garrettkjohnson Thanks, Bruno! That’s what I’m aiming for! 😄

VoR's profile picture
VoR1 year ago

@garrettkjohnson Whats shapecst? Is that like a sphere cast you might find in unity? Is it all "casting" or are you also doing capsule intersection testing with other primitive bounding shapes like cuboids & spheres?

Andrew Chen's profile picture
Andrew Chen1 year ago

@garrettkjohnson This controller uses the built-in shapecast feature from three-mesh-bvh. I actually checks for intersections between shape and BVHs. Rapier provides a shapecast more similar to Unity’s. I will upgrade it to #Ecctrl later on.

VoR's profile picture
VoR1 year ago

@garrettkjohnson awesome. I can't wait to check out the demo & code for the bvh upgrade to the controller.

Jaroslav Stehlik (mystery)'s profile picture
Jaroslav Stehlik (mystery)1 year ago

@garrettkjohnson I am personally more interested in the controller it self. Its actually not easy to write or find a nice character controller which can move on various terrains, edges and detect correctly ground etc.

Andrew Chen's profile picture
Andrew Chen1 year ago

@garrettkjohnson Thanks! For now, you could try out #ecctrl. Using similar technique but a physics-based controller.

James's profile picture
James1 year ago

@garrettkjohnson This is so cool!

Aurelien Vigne's profile picture
Aurelien Vigne1 year ago

@garrettkjohnson Impressive work 🔥🔥🔥

Soweme's profile picture
Soweme1 year ago

@bruno_simon @garrettkjohnson Cool! 👏👏

Ademola's profile picture
Ademola1 year ago

@garrettkjohnson Oh excited 😃! What's the performance compared to rapier?

Andrew Chen's profile picture
Andrew Chen1 year ago

@garrettkjohnson Hard to compare. This controller is optimized for static collisions detection. I tested it with 1,681 map models and held a stable 60fps. Rapier isn’t built for that many trimesh colliders and would likely struggle in a similar setup.

Sean C's profile picture
Sean C1 year ago

@Ademola_4life @garrettkjohnson Does it work to still collide with other physics engine objects like rapier?

Andrew Chen's profile picture
Andrew Chen1 year ago

@Ademola_4life @garrettkjohnson It’s possible to bind a rapier collider with the character, but in that case, I think Ecctrl would be a better choice. 🧐

Nestor Rios Garcia's profile picture
Nestor Rios Garcia1 year ago

@garrettkjohnson 👏👏👏

Andy's profile picture
Andy1 year ago

@garrettkjohnson I had trouble with react three fiber rapier physics with ref/forwardRef for #threejs I submitted a bug report, as AI and I believe it's a problem with the physics component. Maybe it's a newbie issue as it's my 1st react.js project. Can you help?

Vlad Krutenyuk (kvy)'s profile picture
Vlad Krutenyuk (kvy)1 year ago

@garrettkjohnson is it based?

Andrew Chen's profile picture
Andrew Chen1 year ago

@garrettkjohnson yup

Vlad Krutenyuk (kvy)'s profile picture
Vlad Krutenyuk (kvy)1 year ago

@garrettkjohnson is it available to try? im working on char controllers using physics. its very interesting to check alternative way

Andrew Chen's profile picture
Andrew Chen1 year ago

@garrettkjohnson Not at the moment, but you can try out the physics-based controller here

Vlad Krutenyuk (kvy)'s profile picture
Vlad Krutenyuk (kvy)1 year ago

@garrettkjohnson its only for r3f, I work not in r3f

3D Web Games's profile picture
3D Web Games1 year ago

@garrettkjohnson Thanks for the links to ecctrl and three mesh bvh library. I have tried using rapier and the three.terrain library but havent gotten it working perfectly by using a heightmap yet. I will try these libraries.

Sourabh's profile picture
Sourabh1 year ago

@garrettkjohnson What does bvh stand for ?

PowerBeatsVR's profile picture
PowerBeatsVR3 years ago

VR fitness app PowerBeatsVR has just made its way to the official Meta Quest store! Grab it now and enjoy a fun workout anywhere, anytime, and without any subscription ever:

Related Videos

Introducing GGEZ: The Nextjs for ThreeJS Games It's an open source framework which adds all the missing pieces to vibe code better ThreeJS games It has full codex integration, so a $20 ChatGPT sub is enough to build games! Literally "bun run start" and you have the full development environment on localhost 0. GGEZ Runtime - Abstraction layer over physics libraries - Character Controllers - It's just ThreeJS, no magic - Load ggez scenes and animations automatically 1. Trident - a World Editor - Codex World agent - A full editor to build scenes - Including Mesh editing, vertex, edge, face - Terrain sculpting - Physics and Player Controller settings - It's just exporting json files and glb assets, no magic 2. Animation Studio - The best you can find on the web - Codex Animation agent - Build state machines and animation graphs - Multi dimensional blend trees - Clip Editor: Create new animations with codex or edit keyframes - Equipment Editor: Never miss the placement of your rifle anymore - ROOT MOTION SUPPORT 3. GGEZ CLI Yea relax, it works fully headless and you can just create new games with bunx create-ggez new-game But at this point just use vanilla threejs?? Anyways if you are like me and you can't guess with code where objects should be placed and you are fifty prompts deep into figuring out where that box should be placed, this is for you If you are an anti AI game developer who insists that this is slop, then just leave a raging comment below please it's good for the algo 🙏 The whole thing is absolutely experimental and things will break as i move very fast, but I will be building my game with it so i will make sure it becomes stable asap! Link to repo below

robot

44,009 views • 3 months ago

Why the character movement in my custom game engine felt janky and how I fixed it. In a game engine, most often, a character moves using the physics engine. Meaning, the player is not just a coordinate in space but a physical body. It has velocity, it handles collisions, and it interacts with the world. Now, as you might know, physics engines need stability. If you run them at variable framerates, things start breaking. Objects phase through walls or fly off into space because the math becomes unpredictable. This is why most game engines lock their physics loop to a 60Hz fixed rate. But here’s the problem: If you have a high-end system, you don't want to limit it at 60 FPS. That's a waste of good hardware. Now, that said, if the GPU is rendering at 144 FPS but the player's position (physics driven) only updates 60 times a second, it creates a micro-stutter that ruins the "smooth" feel of the game. A good way to fix this is to treat the character as two separate things: 1. The Physics Body (Invisible part): This is the "real" character. It lives in the 60Hz physics world, it moves the player and handles collisions. 2. The Visual Model and Camera (Visible part): This is what the player actually sees. It doesn't care about collisions, its only job is to look nice and smooth at whatever framerate the GPU is pushing. Once you have this separation, you can use interpolation to keep them in sync. Every time the physics clock ticks, you save the previous position of the invisible body before moving it to the new one. Between those ticks, calculate how far we are between the last physics update and the next one. By using this to drive the visible parts of the game, the stutters disappear. The physics loop stays fixed behind the scenes, while the visuals slide smoothly between the snapshots. Example: - Right after a tick: blend_weight= 0.0 (The visual model stays at the old physics position). - Halfway to the next: blend_weight= 0.5 (The visual model slides to the middle point). - Just before the next: blend_weight= 0.9 (The visual model is almost at the new physics position). Pro-Tip A critical mistake I made initially, and one many devs make, is parenting the camera and visible parts directly to the player body. If you do this, the camera inherits the discrete 60Hz physics movement by default. In that setup, interpolation won't work because the camera is "stuck" to the physics clock. For this fix to work you must decouple the camera and visuals from the body and move them separately. Player movement processing in Detis Engine: - fixed_process: Physics runs at 60Hz. Handles collisions and raw movement. - process: Variable rate. Mainly used for player input caching in the player case. - late_process: Variable rate. Handles interpolated camera movement after physics and everything else is done being processed. - render. Submits the final interpolated transforms to the GPU. The test environment in the video is running on an old 2070-based laptop. Hopefully the video compression won't introduce any stutter... I’m sharing this in hopes it helps a fellow dev. Cheers.

Ioannis Koukourakis

48,518 views • 6 months ago

Chris Cuomo just tried to blame “MAGA” for the Epstein fallout and Deputy AG Todd Blanche made him look like an absolute FOOL on his own show. “Trying to blame MAGA for what’s happening now is incredible — that is ABSOLUTELY, completely false!” CUOMO: “I’m not blaming you for this, and I’m not blaming Pam for this, but I’m blaming MAGA.” “They made this a bogeyman.” “They made this about a murder plot and about a human trafficking ring that involved all kinds of high-level people.” “And everybody knew it and it had to come out and Trump would deliver.” “So that’s where this is coming from. This is the law that this president signed, and the criticism is, Todd, is you guys are doing more to protect things than the law requires — and what you are protecting are the wrong things.” “That what got redacted that shouldn’t have been hurt survivors, didn’t help the cause of transparency.” BLANCHE: “Look, trying to blame MAGA for what’s happening now is incredible. That is ABSOLUTELY, completely false.” “What’s happening now is Democrats in Congress and some Senators — and a few Republicans in Congress like Massie — are making this their entire existence.” “That’s not MAGA. That’s what’s happening now.” “Criticize all you want, ask questions all you want. I’m on your show. I’m happy to answer any question you have about redactions.” “The law required us to redact every single victim name.” “Not only that, but judges in New York ordered us to redact every name of any woman who said she was a victim of Epstein’s crimes.” “That was not a choice. That was not about us being transparent.”

Overton

64,054 views • 3 months ago