So I created a StaticBody3D to use as the level mesh, and imported a .blend file. But I'm struggling to make it have collision. I know I can add a CollisionShape3D, add a cube shape and drag it to fit but that's not what I want, I want to simply use the same .blend as the collision for the StaticBody3D. Is this possible? how?
#Use the model of a StaticBody3D as its collision
1 messages · Page 1 of 1 (latest)
When you you look above the viewport (where the sun icon etc. are) there should be a mesh button when the mesh instance is selected.
There are optinos to generate collision shapes from the mesh there
so here's the problem
I have a StaticBody3D, not a MeshInstance3D
if I try to create a MeshInstance3D, the problem is that it doesn't let me select the .blend file
it seems to accept any format except .blend
but I want to use the .blend importing feature because it's awesome to save the model in blender and have it update immediately in the viewport
so idk how to do this
these are the file formats recognized for the "mesh" in a MeshInstance3D
if I set it to "all files" and select the .blend anyways, I get this error
Huh, I guess .blend is opened as PackedScene for some reason.
I usually just export from Blender so I'm not entirely sure what's up with that.
I think this means I just can't take advantage of the .blend import feature which would be lame if so
if I open the "packedScene" the mesh seems to be called "ground" which is what I called it in blender
maybe I can select "ground" somehow?
Yeah I guess it makes sense. The other export formats, too, contain mroe than meshes. They turn the blender objects into nodes.
Like if I export my player the blender armature turns into an armature etc. yea
With the formats I've used there was a way to grab the mesh, though an export setting menu, but I'll have to check how blend work myself
I guess I'll just use gltf for now
but if you find out I'd love to know
so @odd gust , with gltf, what should the node structure look like?
should the MeshInstance 3D be a child of a StaticBody3D?
Yeah
wtf it doesn't let me select a .gltf file either
how do you do it?
er sorry, .glb
it's also imported as a PackedScene
I usually just right click a .glb or .gltf and select NewInheritedScene. ...actually, maybe same works for .blend I dunno.
You can also doubleclick and you get an importer where you can tell Godot to extract a mesh or materials.
AHHHHHHHHHH
I can do that
but will the inherited scene update itself automatically when I update the .blend?
okay so what do I do after I open the inherited scene?
I kinda remember having some trouble with that. With mesh not always updating. Reinport forces update I think.
Anyhow the inherited scene is a scene. So you can add w/e to it. I often override materials in them, add colliders, scripts etc.
You can also right click a ndoe to change it's type
oh
Like if you want the root node to be a staticbody3d
so I add the collision into the scene?
how?
bruh lmao
so weird
wait I don't see "convert" anywhere in your screenshot
ah
change type
Yeah
I'm very confused rn
What Godot version you have? Though I have no idea when the change type was added.
4.3 beta 3
but anyways I think I found the solution
if I double click the .blend in the filesystem
I get this window
and as you can see, I can change the "root type" to be MeshInstance3D
so now, this .blend is a MeshInstance3D when I drag it into the scene
is that useful?
Oh I see! I'm on 4.2 stable. Maybe they changed it. Looks useful.
so what should my next step be now that this is a MeshInstance3D?
Oh wait it changes the root right? So maybe root should be StaticBody3D
As an example this is how I set some of my floors
I opened the scene and added a CollisionShape3D
how do I select "ground" as the collision shape now?
Alternatively, if you don't wanna use a box col or some other simple shape, you can use this menu with meshinstance node selected to generate one that matches the shape of the mesh.
that's what I want yes!!!!!
But I often use simple shapes when it makes sense, better performance.
I don't want to use a box shape as the collision
I want the model to be its own collison
because the idea is to model a full level in blender
I see!
I usually make a bunch of pieces in Blender and design them to fit on a grid.
But designing whole levels in Blender sounds cool, too. Heard environmental artists often do that kind of thing.
Btw if you name a mesh inside Blender so that it contains "-colonly" it will be used for collisions only when imported to Godot.
Sometimes handy.
ohh yeah that sounds useful
@odd gust collision!!!!!!!!!!!!!!!
I understand it now, thank you!!!
Hey no problem, the importing stuff in Godot is a little weird for sure!
one last question
Also if .glb is wonky or won't update you can also try .gltf I think it's made around the idea of exporting the materials etc. and editing them separately.
I edited the .blend and godot succesfully picked up on it and updated the mesh, but it's not reflected in the viewport for some reason
if I launch the scene, the model is updated, but the viewport hasn't updated
do you know how to update it?
I think there's a reload project option in the menu somewhere
damn
Yeah Project -> Reload project
lol yeah
I often get weird issues when importing stuff to Godot from Blender
Mesh not updating, or visual glitches that need restarting Godot. Or sometiems just reloading the 1 scene works.
And if I change like normal data or such, not geometry. SOmetimes Godot doesn't realize something changed and I need to hit the Reimport button on the resource.
It's a little fiddly sometimes.
yeah reloading the scene works
cool, thank you!
I'm not 100% sure about whether I should be making the entire levels in blender btw
it's just what I gravitate towards atm
my only gamedev background is that I make mario 64 romhacks and that's how I've always made my levels
Ooh!
but making individual assets and placing them is probably more efficient idk
I did a 9 months Unity course at a low-level school. I made entire rooms in Blender for my final project, which would generate these tunnels from the rooms.
I wasted a lot of time on the UV unwrapping. But if you keep separate meshes in Blender it's probably a fine way to do it, too.
So that's why I've done in in Godot instead of Blender this time. But hey w/e works.
I think the tile way is probably more efficient for bigger games yeah.
Though I guess you can also make copies of objects in Blender that share the same mesh data, which would work very similarly to usign duplicates of say a wall or floor peice scene in a game engine.
you can instance in blender yeah
like if you make a streetlight model and you use it all around the level
if you duplicate it with alt+d, it's instanced, and if you edit one of the streelights, you're editing all of them
Yeah. I have very little experience with that workflow so I dunno how it works in Godot. Could be great, could be bad. No clue.
this is my most recent sm64 project in case you're curious (this is a video of a youtuber, who organized the competition I participated in, playing through it)
I modelled the entire office, animated all the charactes, etc
Stream: https://twitch.tv/simpleflips
Merch: https://simpleflips.shop
Twitter: https://twitter.com/simpleflips
Discord: https://discord.gg/simpleflips
Full Vods Channel: https://www.youtube.com/simpleclips
VOD: https://www.youtube.com/watch?v=0AV8FLH-uKQ&t=7672s
Hack: https://romhacking.com/hack/rhdc.ppt
Edited by: Matt & Nolan (@PowerPalette)
...
a friend helped me with the coding part, but I also handled a lot of the coding
now I wanna transition into real gamedev
Whoa that's really cool!