Author Topic: How do I add collision to a brick?  (Read 2593 times)

So I'm working on a larger version of a wedge brick to reduce brickcount. The brick shows up in-game but has no collision nor can it be hammered. All I have is the model in blender with nothing else, what more would I need?

In my BLB Exporter thread there is a link to an example brick that has DTS collision which is required if you want the collision to follow that diagonal bit correctly: https://forum.blockland.us/index.php?topic=304534.msg9322793

Tried my best to follow the example but failed, tell me where I forgeted up if you can.
[link is now outdated]
« Last Edit: May 17, 2017, 12:53:13 AM by Cowboy Dude »

Double bump but I had no idea what layers were, somewhat of a beginner to blender. Now that I do I tried and did my best to copy the other .blend files as similarly as I could. I still cannot get my brick to have collision. Perhaps I messed up the exporting process or maybe I missed a crucial element.

https://www.dropbox.com/s/aod8e6tra1d4vz0/8x12x5WedgeR.blend?dl=0

Triple bump (sorry) but I can't wrap my head around this and it's really delaying a project I want to work on.

1. Get the brick working without collision.
2. Get port's dts exporter
3. Make a collision shape, no surfaces with more than 4 points, convex shape(that means no dents, or outside angles less than 180 degrees)
3a. Blender has a tool for this.  Edit Mode > A(Select all) > delete(edges and faces only) > complete operation
3b. A(again, to select all vertices) > V(or was it ctrl+V, I don't remember) > "Convex shape"(it should make a convex shape and delete unused vertices)
4. Add the collision shape to a group.
5. Name the group "Collision-1"
6. Select ONLY the collision shape.
7. Use port's exporter to export the shape as dts( make sure you check the "selection only" box when exporting)
8. Move the exported .dts to your brick folder.
9. Modify your brick datablock (in server.cs?)  add the field "CollisionShapeName = "folder/folder/folder/folder/shapename.dts";"
10. Profit???

I hope that helps.

you dont need to do the collision shape as group or deleting surfaces. you do have to make sure the shape fits inside the bounds of the brick or else it will have problems (keep in mind dts shapes are doubled in size ingame). on top of that, if the rotation is wrong you have to restart bl entirely for the any new dts collision to be used.
« Last Edit: May 23, 2017, 10:47:23 AM by Conan »

I've found scaling the shape down 50% before exporting to dts usually is the correct scaling.

I've found scaling the shape down 50% before exporting to dts usually is the correct scaling.
it is. dts scaling is 50% the size of brick scaling.

1. Get the brick working without collision.
2. Get port's dts exporter
3. Make a collision shape, no surfaces with more than 4 points, convex shape(that means no dents, or outside angles less than 180 degrees)
3a. Blender has a tool for this.  Edit Mode > A(Select all) > delete(edges and faces only) > complete operation
3b. A(again, to select all vertices) > V(or was it ctrl+V, I don't remember) > "Convex shape"(it should make a convex shape and delete unused vertices)
4. Add the collision shape to a group.
5. Name the group "Collision-1"
6. Select ONLY the collision shape.
7. Use port's exporter to export the shape as dts( make sure you check the "selection only" box when exporting)
8. Move the exported .dts to your brick folder.
9. Modify your brick datablock (in server.cs?)  add the field "CollisionShapeName = "folder/folder/folder/folder/shapename.dts";"
10. Profit???

I hope that helps.
It's so simple but I can't do it sorry. It's not working out for me. Absolutely 0 collision.

Is it possible to use multiple .dts meshes to get a concave collision mesh? I'm turning the 8x8 grill into a ramp, and the border is flat on either end so that you can actually attach it to stuff. I can't remove that or there's no flat surface to attach it to, but if I don't, it's a concave shape.
Sorry if I'm kind of hijacking the thread, but it's relevant.

Yes, but the collision may not work well with vehicles.

Also, from what you're describing I don't think that would be concave.  But I'm not looking at it so maybe you know better. :-[]

Well, I fiddled and got a working collision shape.
https://leopard.hosting/download.php?f=eeoch&name=COL8x12x5WedgeR.dts

I also recorded while I did it- so maybe you can figure out what you did wrong?
https://youtu.be/beZm2ZZ1IEE
« Last Edit: May 28, 2017, 01:28:49 AM by Tendon »

I also recorded while I did it- so maybe you can figure out what you did wrong?
https://youtu.be/beZm2ZZ1IEE
Yeah so that weird ass stuff you saw was me trying to copy an example of Demian's blb file. My mistake there was not knowing there was an add to group thing if you scrolled down that menu, assumed it was that ctrl-j command or something. Your instructions were very clear but again it was one of those things where I'm idiot and the answer becomes very clear when shown.

Is it possible to use multiple .dts meshes to get a concave collision mesh? I'm turning the 8x8 grill into a ramp, and the border is flat on either end so that you can actually attach it to stuff. I can't remove that or there's no flat surface to attach it to, but if I don't, it's a concave shape.
Sorry if I'm kind of hijacking the thread, but it's relevant.
You can. Use multiple meshes named Collision-100, -101, -102, etc