Ok. I have this cool, but simple idea for a cloth in blender game engine. There is an object, and it is a plane. The lower 2 vertices are parented to a dynamic object inside a hemisphere which only restricts the motion of the dynamic object. When the player collides with the dynamic object, the lower 2 vertices are pushed with the dynamic object up. And when the player leaves, and is not pushing against the ob anymore, the ob rolls back down the inside of the hemisphere which only collides with the OB. Does anyone get my idea? And if so, How would you parent an object to vertices?(not an armature, because if you push an armature the whole object goes with it.)
Any ideas?
edit----
I’m not trying yo parent the vertices, I’m trying to have them copy the location of the 2 “guiding” empties colored in green and pink.
What I need to know is if there is a way you can parent an object to vertices, and if you can have multiple parents of one objects in this way. Is there a way to do it using python? Copy location? anything?
First of all, just because people don’t respond within 4 hours of your post dosen’t mean you should get all crazy. Give a post at LEAST a day to pick up.
Second, there is no way to parent vertices to objects. You can parent objects to vertices, but no vertices to objects.
Oh, well that’s what I meant How can you parent an object to a vertex then?
edit—
like, I want an object to be parented to 3 vertices of an object, and I want a different object to be parented to a different 3 vertices of the same object. Can this be done? and is it also possible to make a “movement restriction” object that the parented objects to the vertices will collide with but not the player? Sorry If it’s not that readable.
I don’t think this is possible. It probably could be faked, but it would be hard as you cannot animate the vertices on the COLLISION mesh, and you can parent an object to vertices, but you can’t animate them and make the object move.
No, I want the object to move, and the vertices to move with it, not the other way around. Like the object is pushed, the vertices copy the location of the ob or something.
This is possible, if you know which vertex you want the object to follow, you can go through the list of points and set the position of child objects to that point. But the way blender indexes the vertexes is hard to say.
Hey I am working on sorting though the .getVertex()
The biggest problem is that If you try to move a vertice in the list like:
owner.getMesh().getVertex(0,1).setXYZ([0,0,0]) It will move a vertex but only to one of the faces of your mesh.
I’ve been sorting though and right now I have the power(python) to Move a vertex (which finds all the vertices that deal with the one ytou want to move and and it moves it). And Sort faces to move them as well… So creating a morphing or explosion script is ever more possible
How .getVertex works: (applies to triangleated meshes
-getVertex(material number, Face(vertex))
-the length of the list in .getVertex is # of faces * 3 (3 vertices perface)
-The vertex data is repetative (i’ve been able to find all the reapeating vertices and store them when wanting to move recall them)
When I am done build this deconstruction of .getVertex() i’ll be more then happy to share it… Bug I am still fixing a few bugs
Subtabi gave you a hint how to do it in python. A few months ago someone posted a zip of a flag snaping in a kinda wind. that used the getvertex() method. Unfortuntely I cannot remember who it was and those methods are not in the standard game engine documentation.
Currently you can move faces perfectly! but the moving of vertices need a little work becuase my current version has a few repeats of vertices
Directions:
-up arrow :: Move face up
-down arrow :: Move face down
-left arrow :: Switch face +
-right arrow :: Switch face -
I really hope this helps create your cloth sim don’t give in so easily! Ill try to finish and fix this script in hope it would power more people to create script that deal with the vertices…
Umm, I wouldn’t give up normally, but I don’t know any thing about python except basic property and location getting and setting stuff. So I don’t undaerstand that script at all!
If you have the concept and know the math behind cloth then I am sure I can try it in python… just fill me/us in… maybe draw more images and documents?
Well, yeah, It’s simple, really:
The object, which resides in a hemisphere that only collides with it, is pushed by the player, as shown. The 2 vertices at the bottom copy the location and the rotation of 2 empties belonging to the object on either side. See the diagram:
Or, you could have it like this:
In which the black empty #1 and all of it’s children do not collide with the upper hemisphere, and the black empty #2 has child empties which control the central point in the cloth. The player would need to be taller to be able to collide with the black empty #2, but this is just the basic idea. This way it would be more like a cloth and less like a stiff board nailed on a pivot, because at least the central point would be able to bend and stuff. Tell me if you understand this or if it needs more explanation. 8)
thanks for the support.
edit-----------
oh yeah, and the reason fo the hemispheres is so that when the player is no longer there, the empties “slide” back down the inside of the hemispheres quickly to give the effect of a falling cloth.
hm… ok i’ve been messing with the vertex stuff and found if you use a plane all that extra code is not even needed, its for only that are solid like sphere! So cloth is be a lot more easier plus I found a great site that has a cloth demo…
I asked for what knowlege I should know before doing cloth and well they told me spring and gave me a great reference (thanks game dev people!) anyways there a nice example… so a lil closer to cloth i guess