I’m working on a script that will cause an object representing the cursor to move along the plane defined by X = 0 in the local coordinates of another object (the character). This object that follows the cursor is able to add objects to the scene, like some kind of magical conjuring.
I have a working script that does this along the plane defined by X = 0 in the world coordinates. The script is called “avatar” in the attached blend file. Here it is for reference:
cont = GameLogic.getCurrentController()
own = cont.getOwner()
over = cont.getSensor(“over”)
if over.isPositive():
pos = over.getHitPosition()
own.setPosition([0,pos[1],pos[2]])
It works nicely. The problem is that I want to give the player the ability to move the character from left to right instead of running along a track, with the same ability to conjure objects directly ahead in the sky and on the ground. I need to know how to convert the mouse position in the character’s local coordinates into world coordinates and pass those to the cursor object, so that it can set it’s own position. This is the best way that I can think of to accomplish what I need. Here is what I have so far:
cont = GameLogic.getCurrentController()
own = cont.getOwner()
over = cont.getSensor(“over”)
if over.isPositive():
pos = over.localposition()
targetlocal = ([0,pos[1],pos[2]])
targetworld =
The old script uses some deprecated functions, so I am trying to update them, but I’m not sure if I’m doing that right. I would pass “targetworld” to the cursor object, and set it’s position to that.
Here is the blend file. It is just an alpha. Eventually, there will be a snowboarding Yeti.
Thanks for any help.
Attachments
yetiprototype005.blend (808 KB)