do you know if there is a function to get the normal vector of this collision points.
Not directly, but via a detour. There's the following function for Dyverso particles:
[Vector, Vector, int, float] getNearestPointToObject( Vector, string )
Find the nearest point in the object to the particle in a specific direction. If direction is set to 0 then just the nearest point is found.
Arguments: 1) Direction which is normalized internally. 2) Object's name.
1) Nearest point 2) normal at the nearest point
3) index of the face and distance 4) None if no nearest point is found.
Here's some code that should work.
Code: Select all
velScale = 2.5
collPoints = Sphere01.getCollisionPoints(scene.getObject("Cube01"))
for point in collPoints:
for particle in DY_Domain01.getParticles():
results = particle.getNearestPointToObject(particle.getPosition(), "Sphere01")
if (len(results) > 1 and results == True):
velDir = results
velScaled = velDir.scale(velScale)
I've never used this function, but "result" contains vectors at least
. You can also see that I've used "particle.getPosition()" as an argument. The description says that it's normalized internally and this gives you the required direction. When you scale it you get some "fake" velocity. It's not physically accurate, but should do it.