Bouncing ball

kxa422 kxa422 at yahoo.fr
Sat Apr 14 03:14:38 PDT 2007


I've try Ron's idea and the result is more than funny. It's the reflexion 
angle after collision that doesn't work properly, the idea is very good.

----- Original Message ----- 
From: <ordinal.malaprop at fastmail.fm>
To: "Scripters" <secondlifescripters at lists.secondlife.com>
Sent: Thursday, April 12, 2007 8:16 PM
Subject: Re: Bouncing ball


Yes, that was the sort of script that I was using, only I found that
it activated at all sorts of wrong times, and I ended up propelling
things in the wrong direction; it would go off after the collision,
or before it, or whatever it felt like. Havok doesn't properly
integrate with LSL it seems.

I don't think I tried Ron's idea #1 though, a short delay, which
seems like a good idea.

On 12 Apr 2007, at 19:56, Kage Seraph wrote:

> Yomp, you're looking for collision_start(integer foo) and  land_collision 
> start().
>
> for a collision on a level flat surface, pseudocode:
> vector vel = llGet[Detected]Vel([0]);
> vel.z = vel.z * -1; //for a perfectly elastic collision (i.e., no  KE 
> dissipation).
> //for a nonelastic collision, change -1 to some proportion between  0 (no 
> bounce) and -1 (full bounce)
> llApplyImpulse(vel, FALSE);
>
> This would continue the x and y components of motion, and leaving  the 
> parabolic z component motion (z = -a/2*t^2 + bt + c) up to  havok.  In the 
> case that the collision does NOT eat up old x and y  motion, you'd want to 
> add vel.x = 0; and so on.
>
> Maybe throw in a bit of llApplyRotationalImpulse in the direction  of 
> travel for realism as well?
> Kage
>
>
> Ron Blechner wrote:
>> You can get the detected velocity on a collision event, and  calculate a 
>> reflected angle based on the initial velocity, and  apply an impulse in 
>> that direction.
>>
>> to find the appropriate reflected angle, it depends whether you're 
>> hitting an object or a ground - which are two events, collision  and 
>> collision_ground (i think)
>> On ground, you can use llGetSlope to get the angle. On regular 
>> collision, a few ideas:
>> 1. set a timer for a split-second later (presumably after the  collision) 
>> and THEN get the velocity, and just impulse in that  direction
>> 2. Get the bounding box for the object that the ball collided  into, and 
>> base it off that geometry. (needs some fun math
>>
>> -Ron / Hiro
>>
>> On 4/12/07, * JJ Ventrella* <Ventrella at lindenlab.com 
>> <mailto:Ventrella at lindenlab.com>> wrote:
>>
>>     Hey Andrew, doesn't Havok allow some kind of softness to  collisions? 
>> I
>>     know you could achieve this by modeling a solid using many
>>     springs, and
>>     I realize that rigid body dynamics is inherently "hard" by  nature.
>>     But
>>     might Havok have any user-tweakable parameters that allow a
>>     collision to
>>     be stretched over time (as in the period of time it takes for  a 
>> beach
>>     ball to make contact, compress, and then leave the ground) with
>>     forces
>>     distributed non-linearly? (I'm just makin shit up).
>>
>>     -JJ (lover of bounciness) V
>>
>>     ordinal.malaprop at fastmail.fm  <mailto:ordinal.malaprop at fastmail.fm>
>>     wrote:
>>
>>     > You could script it to apply a little impulse to itself on
>>     > collision_start and land_collision_start (or _end).  Unfortunately,
>>     > the times I've tried this - as it happens, the opposite way,  to 
>> try
>>     > to get things to hit the ground and stay there but keep  rolling -
>>     > it's not been very reliable. You can never quite tell when the
>>     > impulse gets applied. Worth a try though.
>>     >
>>     > On 12 Apr 2007, at 18:26, kxa422 wrote:
>>     >
>>     >> The beach ball bounce as a stone in sand.
>>     >> Noone have an idea how to make it a little bit more  realistic ?
>>     >>
>>     >> ----- Original Message ----- From: "Harleen Gretzky"
>>     >> <Harleen at comcast.net <mailto:Harleen at comcast.net>>
>>     >> To: "Scripters" <secondlifescripters at lists.secondlife.com
>>     <mailto:secondlifescripters at lists.secondlife.com>>
>>     >> Sent: Wednesday, April 11, 2007 11:21 PM
>>     >> Subject: Re: Bouncing ball
>>     >>
>>     >>
>>     >>> Just make it physical and it will do that automatically,  you can
>>     >>> play with the material, like make it rubber to give it
>>     more  bounce.
>>     >>> you would only need scripts to give it noise or extra   pushes.
>>     There
>>     >>> is a Beach Ball in your library that is open source  that  does
>>     that.
>>     >>>
>>     >>> ----- Original Message ----- From: "kxa422" <kxa422 at yahoo.fr
>>     <mailto:kxa422 at yahoo.fr>>
>>     >>> To: "Scripters" <secondlifescripters at lists.secondlife.com
>>     <mailto:secondlifescripters at lists.secondlife.com>>
>>     >>> Sent: Wednesday, April 11, 2007 6:16 PM
>>     >>> Subject: Bouncing ball
>>     >>>
>>     >>>
>>     >>>> Hello,
>>     >>>>
>>     >>>> Is there someont that have an idea to create a ball
>>     that  canbounce
>>     >>>> each it touch the ground or object ?
>>     >>>> Like a tennis ball for instance.
>>     >>>> I know how to detect collision with objects and ground, but
>>     how  to
>>     >>>> send the ball back is a little bit more misterious for me.
>>     >>>>
>>     >>>>
>>     >>>>
>>     >>>>
>>     >>>>
>>     >>>>
>>     >>>>
>>     >>>>
>>      ____________________________________________________________________
>>     >>>> _______ Yahoo! Mail réinvente le mail ! Découvrez le nouveau
>>     >>>> Yahoo! Mail et son interface révolutionnaire.
>>     >>>> http://fr.mail.yahoo.com <http://fr.mail.yahoo.com>
>>     >>>> _______________________________________________
>>     >>>> Click here to unsubscribe or manage your list subscription:
>>     >>>> https://lists.secondlife.com/cgi-bin/mailman/listinfo/
>>     >>>> secondlifescripters
>>     >>>>
>>     >>>
>>     >>>
>>     >>> _______________________________________________
>>     >>> Click here to unsubscribe or manage your list subscription:
>>     >>> https://lists.secondlife.com/cgi-bin/mailman/listinfo/
>>     >>> secondlifescripters
>>     >>
>>     >>
>>     >>
>>     >>
>>     >>
>>     >>
>>     >>
>>     >>
>> 
>> _____________________________________________________________________ _
>>     >> _____ Yahoo! Mail réinvente le mail ! Découvrez le nouveau  Yahoo!
>>     >> Mail et son interface révolutionnaire.
>>     >> http://fr.mail.yahoo.com
>>     >> _______________________________________________
>>     >> Click here to unsubscribe or manage your list subscription:
>>     >> https://lists.secondlife.com/cgi-bin/mailman/listinfo/
>>     >> secondlifescripters
>>     >
>>     >
>>     > _______________________________________________
>>     > Click here to unsubscribe or manage your list subscription:
>>     >
>>     https://lists.secondlife.com/cgi-bin/mailman/listinfo/ 
>> secondlifescripters
>>     <https://lists.secondlife.com/cgi-bin/mailman/listinfo/ 
>> secondlifescripters>
>>
>>
>>     _______________________________________________
>>     Click here to unsubscribe or manage your list subscription:
>>     https://lists.secondlife.com/cgi-bin/mailman/listinfo/ 
>> secondlifescripters
>>     <https://lists.secondlife.com/cgi-bin/mailman/listinfo/ 
>> secondlifescripters>
>>
>>
>> --------------------------------------------------------------------- 
>> ---
>>
>> _______________________________________________
>> Click here to unsubscribe or manage your list subscription:
>> https://lists.secondlife.com/cgi-bin/mailman/listinfo/ 
>> secondlifescripters
>>
>
> _______________________________________________
> Click here to unsubscribe or manage your list subscription:
> https://lists.secondlife.com/cgi-bin/mailman/listinfo/ secondlifescripters

_______________________________________________
Click here to unsubscribe or manage your list subscription:
https://lists.secondlife.com/cgi-bin/mailman/listinfo/secondlifescripters 


	

	
		
___________________________________________________________________________ 
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
http://fr.mail.yahoo.com


More information about the secondlifescripters mailing list