-
Senior Member
Easy question for everyone
What's an easy to do, non performance issue causing way to "throw" several basketballs or other small obects at the rider?
-
Re: Easy question for everyone
I know you said easy, but spend some time learning the object position event. There's some great tutorials and help out there covering exactly what you want to do!
Once you've wrapped your head around OPE's you'll start to see some incredible new creative directions as well as solving your current problem.
It's not as hard as it might seem at first, it just takes a bit of time to get your head around! Good luck!
-
Re: Easy question for everyone
Yeah, an OPE could work, though I don't think it's as easy as you were hoping. I cannot only visualize it so much in my head, but you'd need to use at least two OPEs per basketball - one for it being 'thrown' at the player, the other for making them bounce off and roll away.
Since you're wanting to throw things at the player, you'd need 3 Object Info Data Sources to get the Players X, Y and Z position. You'll also need 3 Curved Data Sources (per basketball...) - one for each axis. The 3 Object Info Data Sources represent your 'End' values for the 3 Curved Data Sources. Things get a little more complicated there, as you're suddenly presented with the problem that you need to set the OPEs Modify Position to Global, which means you now need to get the starting position of the basketballs, which needs to be used as the 'Start' value of the Curved Data Sources. You don't think you can use the Basketballs themselves, since they'll be moving, and they're values will always be changing, so... it's probably easier to set up dummy objects as starting positions for each basketball, then again use 3 Object Info Data Sources that read the X, Y and Z Position of the dummy object.
So, so far, for each basketball, you'd need:
An OPE.
An Interval Trigger to fire the OPE every tick/frame.
3 Curved Data Sources - one for each axis for the ball.
A Dummy Object - as a starting position for the ball.
3 Object Info Data Sources - to read the X, Y, Z position of the starting point.
That's 9 objects, and I'm not sure I even included everything without trying it myself. There's also still the 3 additional Object Info Data Sources for reading the players position.
And that's just for the basketball being thrown at the player. We didn't get to the bounce yet.
Not so simple then, really! 
Another possible but totally different solution, which doesn't rely on OBEs but might be more intensive, could be to glue a Directional Force to the basketball. Turn off the gravity for the basketball, enable physics, and have the Direction Force always pointed at the player. Then use a Hit Trigger so that when the ball hits something, you enable it's gravity and disable the Directional Force.
That's the gist of it anyway... there's obviously a little more to it than that (for example, you'd need a Variable Data Source that enables/disables the gravity of the basketball), but it might be a more simple set up.
Let us know how things turn out!
-
Re: Easy question for everyone
If the source of the basketballs is close enough to the rider/driving line so that it is inside the physics range, you can use the physics engine to do the throwing by giving the ball a good initial force. This approach also needs the OPE to set the original position of the ball to the launcher which then gives the force to the ball. If balls fly form outside of physics range, you have to animate the whole path of the ball or the path inside the physics range.
Collisions work much better if you can make the object to be moved by physics engine (forces) instead of OPE.
-
Senior Member
Re: Easy question for everyone
hi maybe using the directional force apply set to object, will work!!hmm, not sure if there is also a local effect that can just effect the ball, that would be handy as it would simulate a launch. also the direction force can be set to point at object, so it could be pointed to the bike or an object tracking in-front.
-
Re: Easy question for everyone
That's what I said... :/
Also, it sounds like you're confusing the Directional Force with the Area Effector. Directional Forces are tied to an object and will only effect that object. Area Effectors can apply force to many objects (but can still be setup to effect only objects by choice).