Throw Object?


Is there a way to make it so that you can throw objects in the GE? Like you left click on an object, then move the mouse and release the left button, an the object keeps it momentum.


A guy did something very similar in this template:

Ok thats kinda what I want, but I just want on object to follow the mouse when you click on it, then keep momentum when you let go.

Python is probably going to be required…
(I don’t know much about python though:no:)

Ok well can anyone tell me how to make an object follow the mouse, and maybe allow me to move closer or farther using the mouse wheel?

I was actually just working on having an object follow the mouse position!
Here is the simple game template I was just working on. (With your scroll thing added)


Game.blend (60.6 KB)

Umm, are you sure thats the right one? It seems to be a game where you break ice blocks.

But the dot is controlled by moving the mouse!
What doesn’t it do that you asked for?

Oh okay I got it now. But a couple things. Is there a way to make it follow on all three axis, and move towwards the camera when you scroll the mouse wheel?

3 axis?
It should move towards the camera when you scroll the mouse wheel now.

Ya but I want to be able to move the camera and still have it work exactly like your example. Just according to the cameras angle.

How about this:


MousePositionTest.blend (68.6 KB)

Getting there, but if you rotate the camera, it gets kinda screwed up. Basically I want a character with mouselook, and you can click on and move objects while moving around. If you can’t do this it’s not a big deal. I got another idea for a game with a stationary camera.

Edit: With your first example, is there a way to make it stop following when you want?

What I would do is when using the mouse-look, make an empty follow your mouse. Then when you click on an object (maybe detect this using rays and keyboard sensor), make that object parent to the empty, and take off it’s dynamics. Then when you release the key, unparent it and restore dynamics.

The only problem with that method is that the momentum won’t work. I also am having trouble making a spaceship game, and I need the rockets to go +40 speed, with an additional speed that the space ship is moving.

I swear I thought I saw a .blend somewhere of your situation. I’ll try to look it up for you.

Alright. If you can find it that would be awesome.