su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 29 Apr 2012 07:51 AM |
How would I get a 'bounced vector' of a vector? Like
| |<-- | (1,0) Turns into | |--> | (-1,0) And | |\ |..\ (0.5,0.5) Turns into |../ |/ | (-.5,.5)
Any formulas?
|
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 29 Apr 2012 07:54 AM |
?
Uhm....
Lol is it just me... but...
{1,0) * {-1, 0}
? |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 29 Apr 2012 07:57 AM |
If you multiply vector with -1 you get the opposite direction vector It would work for something like |<--
But not for
|\ |..\ |
|
|
| Report Abuse |
|
|
| |
|
| |
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
| |
|
| |
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 29 Apr 2012 08:05 AM |
DigitalMirage, last time i checked abs it gives positive values..?
@su
Our parts (i guess it are parts right? Or if a gui, its 2d) want to have opposite directions.
Well, we can just do
function hit(part) part.Velocity = part.Velocity * Vector3.new(-1,-1,-1) end
--well i guess you understand we need an touched event here xD
Lol, its kinda interesting. If you like use -.99 it even slows down a little :D |
|
|
| Report Abuse |
|
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
| |
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 29 Apr 2012 08:08 AM |
First off.. That's based on roblox physics system thingy.. Second.. That would always go back in the exact direction backwards.. A BOUNCE Like in 2d sketch
..\ ...\< thats the direction ....\ ______________ ..^le base^
Then it bounces like
....../ ...../< le direction ..../ ______________ ..^le base^
And I'm not talking about objects.. directions AKA vectors |
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 29 Apr 2012 08:09 AM |
@pwnedu46
That's the same direction backwards.. Not bounce :/ |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 29 Apr 2012 08:13 AM |
Hmm wait thats true...
Okay here it comes. - Im not sure if this all mathematically correct.
Bouncing means actually the following.
It bounces, with same speed, to the OPPOSITE angle of it.
If a ball hits a wall with 45 degrees, then it "debounces" with 135 degrees right?
Okay so, if i get this right we need da following.
You need the angle that the part hits the base. I dont really know how to get that.
To get the debouncing angle, you do the following:
angle = 180 - x
You actually need an angle calculator in every brick I think...
|
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 29 Apr 2012 08:15 AM |
But I need also include the angle of the base that the object hits.. ? |
|
|
| Report Abuse |
|
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 29 Apr 2012 08:18 AM |
Hmm true.
Okay the angle of our ball (the one that hits) is x The angle of the base is y.
hitangle = math.abs(y-x) --always positive, returns angle that hits. Example: base has angle 90 degrees, x has angle 45 degrees, the hit angle is 45 degrees.
Well, our bounce angle is then.. bounce = 180 - hitangle
|
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
|
| 29 Apr 2012 08:23 AM |
Uhm.. So..
a = object.Direction b = baseangle x = math.atan( a.y/a.x ) hitangle = math.abs(b-a) bounce = 180-hitangle a = {math.cos(bounce),math.sin(bounce)}
?
|
|
|
| Report Abuse |
|
|
su8
|
  |
| Joined: 06 Mar 2009 |
| Total Posts: 6334 |
|
| |
|
jobro13
|
  |
| Joined: 05 Aug 2009 |
| Total Posts: 2865 |
|
|
| 29 Apr 2012 08:40 AM |
| Yes, I think so: You should try it :D |
|
|
| Report Abuse |
|
|