Shrinkwrap Constraint in BGE

Hi!! I’m quite new with the BGE…what I’ve done is thank to this forum…now I’m trying to figure out how to apply the Shrinkwrap constraint in BGE.
I make a little example to explain me better. issue.blend (990 KB)
My target is move the ball with the mouse but along the bended wall.

Now the constraint is working outside the game (you can try moving the ball), but when game begin only mouse script drive the ball.

I’m open to solve this target in other ways, but this constraint seems be created for that target :slight_smile:

That is because modifiers do not work inside the BGE, there are a few exceptions and the UPBGE guys are working on applying modifiers at game start, but something like shrinkwrap would not work as intended, as it would only take into account the first frame(my guess)…

Bottom line do not count on modifiers to work in the BGE....sorry.

Thank you very much for your answer!

I understood, I will try to avoid the geometrical references and use some mathematical limit in the mouse coordinates.

Hi Oursgamemf as said by JustinBarrett bge don’t take care the modifier nor the drivers.

BGE is a separate software wich work on the same 3Dscene with it’s own routines.

You have to rebuild modifier with python script.

in your mymouse.py script you try to constraint the Sphere position by 2 ways :
the mouse position AND
by a shrinkWrap constraint.

I redraw your 3D scene
I put 2 separate cylinders to see what happens when jumping from one to other.

The BlueSphere follow the mouse
THe Gray Sphere is "your sphere" 

I try this on UPBGE 0.20

P on the 3D scene to run
PJ : issue3.blend

Attachments

issue3.blend (1.43 MB)

@jolo GREAT WORKAROUND!!! Done exactly what I was looking for! Thank you very much.
If I understood well your script, is better if I update the Blue Sphere position, before update the Gray one, right?

@Oursgamemf

not exactly, if you put 2 constraints on the same object :
if the first constraint say “go right”
and the other constraint say “go left” there is a conflict.

The blue sphere act as a sensor : he send a ray to find object with property “good_prop”
when he find such object we know the impact position of the ray on this object.

the script send the grey sphere on this position.