Author Topic: Static Shape Collision  (Read 4869 times)

I've been experimenting with static shapes lately, but cannot get them to have collision from modeling them in Blender. I created an IcoSphere, and then copied it with Shift+D, and named the copy "collision-0", but there's still no collision. How do you do this? Nothing seems to be able to interact with the object.

Move the collision shape to a different layer

Then in the exporter, where you have detail-0 create a new collision detail level (not loscol)

Set it to use the layer where you put the collision shape on

Move the collision shape to a different layer

Then in the exporter, where you have detail-0 create a new collision detail level (not loscol)

Set it to use the layer where you put the collision shape on
Okay, thanks. I know how to change the levels in the exporter, but no idea how to move shapes to a different layer. How would you do that in Blender?

Select the object and press m

For future reference, it is not necessary to move the collision to a different layer with dts files. I'm not sure where that came from, but I have my collision in the first layer all the time, with no errors or issues.

For future reference, it is not necessary to move the collision to a different layer with dts files. I'm not sure where that came from, but I have my collision in the first layer all the time, with no errors or issues.
When adding a new collision layer in the exporter it asks you to select a Blender layer. I guess there's some neat object name detection going on and it only uses Collision-<anything> as collision meshes instead of all meshes in the layer. I was not aware of this but I guess it works then.

For future reference, it is not necessary to move the collision to a different layer with dts files. I'm not sure where that came from, but I have my collision in the first layer all the time, with no errors or issues.

Depends on exporter version.

The latest available exporter does require you to move the mesh to a different layer; in exchange you don't have to bother with parenting stuff to empties at all. As for older versions, you don't have to work with layers, but parenting is essential.


Like this? The object named "Sphere" is on layer 1, and has a material on it. "collision-1" is what I moved to layer 2, and has no material on it.
EDIT: Now the exporter says "Python error check console".
wat do
« Last Edit: August 23, 2014, 09:30:28 AM by Cruxeis »

EDIT: Now the exporter says "Python error check console".
wat do
Have you considered taking a screenshot of the console and posting it here?

Have you considered taking a screenshot of the console and posting it here?
I figured out the problem - I didn't actually have a location set to save it to. Good job, me. I got the collision to work, but now if I do

datablock staticShapeData(sphereShapeData)
{
    shapeFile = "Add-Ons/Script_Static/sphere.dts";
};

new staticShape(sphereShape1)
{
    datablock = "sphereShapeData";
    position = "0 0 5";
};

and then load that script ingame, doing spehreShape1.setNodeColor("ALL", %numbers); doesn't work, no matter what you substitute for %numbers.

When adding a new collision layer in the exporter it asks you to select a Blender layer. I guess there's some neat object name detection going on and it only uses Collision-<anything> as collision meshes instead of all meshes in the layer. I was not aware of this but I guess it works then.
Depends on exporter version.

The latest available exporter does require you to move the mesh to a different layer; in exchange you don't have to bother with parenting stuff to empties at all. As for older versions, you don't have to work with layers, but parenting is essential.
Ok then. I use the other exporter, so I was unaware.

and then load that script ingame, doing spehreShape1.setNodeColor("ALL", %numbers); doesn't work, no matter what you substitute for %numbers.

Here are some suggestions that allowed me to fully change the shape's color.

Either A: You mispelled sphere
B: Make the texture transparent (Works for me)
C: If you are just using RGB, use RGBA.

Here are some suggestions that allowed me to fully change the shape's color.

Either A: You mispelled sphere
B: Make the texture transparent (Works for me)
C: If you are just using RGB, use RGBA.

Oh, wow, how did I miss that. I was using sphereShape.setNodeColor("ALL", "0.1 0.3 0.5");, while it should be sphereShape.setNodeColor("ALL", "0.1 0.3 0.5 1");. Thanks!

Okay, so I tried UV mapping with a texture, and it didn't work. The texture is a transparent background 16x16 .png, and I followed this tutorial until 3:43. The name of the material on the sphere is the same name as the .png. However, it just shows up as a completely white sphere. Am I supposed to actually put the image on the object in blender, and then name the material with the png? Or am I missing something here?

Okay, so I tried UV mapping with a texture, and it didn't work. The texture is a transparent background 16x16 .png, and I followed this tutorial until 3:43. The name of the material on the sphere is the same name as the .png. However, it just shows up as a completely white sphere. Am I supposed to actually put the image on the object in blender, and then name the material with the png? Or am I missing something here?
If you're using a trans 16x16.png just use the default blank texture. Just make the material name "blank" in Blender it will work. No need to UV unwrap or add textures.

However if you want an actual transparent model instead of colorshifting model then the PNG/material is irrelevant. You need to enable transparency in the exporter.