|
| 16 Jul 2015 05:43 PM |
I see a ton of pros use raycasting with grenades, well I wanna have a go at, or should I? btw, say something is moving from my left side in front of me to the right and I throw my grenade and the object seems to hit the grenade, how should I avoid glitching? also, how should I calculate the "bounce" of the grenade when it's thrown at something?
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
treebee63
|
  |
| Joined: 16 Aug 2010 |
| Total Posts: 376 |
|
|
| 16 Jul 2015 06:00 PM |
I see a ton of pros use raycasting with grenades, well I wanna have a go at, or should I? It's not too difficult, just get all the players and check if they are nearby and in the line of sight of the grenade. http://wiki.roblox.com/index.php?title=Raycasting
btw, say something is moving from my left side in front of me to the right and I throw my grenade and the object seems to hit the grenade, how should I avoid glitching? I don't understand this question. What do you mean by "hit" it, like someone touching it? someone shooting it? someone swinging a sword at it? and glitching as in flying off the map? not exploding?
also, how should I calculate the "bounce" of the grenade when it's thrown at something? ONE SOLUTION is to modify the grenade's velocity when it touches a part. grenade.Velocity = CFrame.new(hit.Position,grenade.Position).lookVector * 100 this is not the best solution when it hits big objects you, maybe a lerp will fix it? |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2015 06:07 PM |
"It's not too difficult, just get all the players and check if they are nearby and in the line of sight of the grenade. http://wiki.roblox.com/index.php?title=Raycasting" No I meant Segmented Raycasting to keep checking where the grenade should fly.
"I don't understand this question. What do you mean by "hit" it, like someone touching it? someone shooting it? someone swinging a sword at it? and glitching as in flying off the map? not exploding?" Well, let's say, just as an example, someone is flying in a plane, and u throw a grenade way up into the air, and then in a second or so the plane hits the grenade...
"ONE SOLUTION is to modify the grenade's velocity when it touches a part. grenade.Velocity = CFrame.new(hit.Position,grenade.Position).lookVector * 100 this is not the best solution when it hits big objects you, maybe a lerp will fix it?" Oh, never thought of that XD but em, why should it not work properly when hitting bigger objects? And how should I fix it with a lerp? o.O
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2015 06:08 PM |
"and glitching as in flying off the map? not exploding?" I mean that say if something hits the grenade, I mean that it glitches by staying there...
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
treebee63
|
  |
| Joined: 16 Aug 2010 |
| Total Posts: 376 |
|
|
| 16 Jul 2015 06:21 PM |
No I meant Segmented Raycasting to keep checking where the grenade should fly. Is the grenade anchored?
Well, let's say, just as an example, someone is flying in a plane, and u throw a grenade way up into the air, and then in a second or so the plane hits the grenade...I mean that say if something hits the grenade, I mean that it glitches by staying there... I need to know answer number 1 before I can answer this one.
Oh, never thought of that XD but em, why should it not work properly when hitting bigger objects? And how should I fix it with a lerp? o.O Don't listen to what I said about that section, it's all wrong. If the grenade is unanchored... just add some Y velocity to it... I can't help you with this section. |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2015 06:26 PM |
"Is the grenade anchored?" Well let's just say no, since I think lito uses Body Thrust for his grenades which obviously means it's not anchored...
"I need to know answer number 1 before I can answer this one." Mmmkay.
"Don't listen to what I said about that section, it's all wrong. If the grenade is unanchored... just add some Y velocity to it... I can't help you with this section." What's all wrong? The part which makes it bounce or about it going wrong with bigger parts? So ur saying add a positive number to the Y Axis Velocity? Why? lerp or what section?
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
treebee63
|
  |
| Joined: 16 Aug 2010 |
| Total Posts: 376 |
|
|
| 16 Jul 2015 06:35 PM |
Well let's just say no, since I think lito uses Body Thrust for his grenades which obviously means it's not anchored... so you want like a trail effect to the grenade? just do something along the lines of...
grenade = script.Parent originalpos = grenade.Position while wait(0.1) do newpos = grenade.Position local part = Instance.new("Part",workspace) part.FormFactor = "Custom" part.CFrame = CFrame.new(originalpos:Lerp(newpos,0.5),newpos) part.Size = Vector3.new(1,1,(originalpos-newpos).magnitude) part.Anchored = true part.CanCollide = false part.Transparency = 0.5 game.Debris:AddItem(part,3) originalpos = newpos end
Well, let's say, just as an example, someone is flying in a plane, and u throw a grenade way up into the air, and then in a second or so the plane hits the grenade...I mean that say if something hits the grenade, I mean that it glitches by staying there... I don't see how touching another part causes the grenade to stay still, is it bodyposition? anchored? I don't know.
What's all wrong? The part which makes it bounce or about it going wrong with bigger parts? So ur saying add a positive number to the Y Axis Velocity? Why? lerp or what section? the velocity of the grenade is influenced the by center point of the part touching, EX, throwing it onto the center of the floor does makes it bounce up and down on the same spot, but throwing it a little to the side will make is bounce away from the original position of the part. |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2015 06:46 PM |
"so you want like a trail effect to the grenade? just do something along the lines of...
grenade = script.Parent originalpos = grenade.Position while wait(0.1) do newpos = grenade.Position local part = Instance.new("Part",workspace) part.FormFactor = "Custom" part.CFrame = CFrame.new(originalpos:Lerp(newpos,0.5),newpos) part.Size = Vector3.new(1,1,(originalpos-newpos).magnitude) part.Anchored = true part.CanCollide = false part.Transparency = 0.5 game.Debris:AddItem(part,3) originalpos = newpos end" Well thnx, but I was just saying it's not anchored, I can do the trail XD
"I don't see how touching another part causes the grenade to stay still, is it bodyposition? anchored? I don't know." No I mean, the way ya'd use raycasting to check for next targetPos and well, u try keep the grenade following the rays at all times...
"the velocity of the grenade is influenced the by center point of the part touching, EX, throwing it onto the center of the floor does makes it bounce up and down on the same spot, but throwing it a little to the side will make is bounce away from the original position of the part." Oh, I see now... what would ya recommend?
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|
treebee63
|
  |
| Joined: 16 Aug 2010 |
| Total Posts: 376 |
|
|
| 16 Jul 2015 06:59 PM |
No I mean, the way ya'd use raycasting to check for next targetPos and well, u try keep the grenade following the rays at all times... Just adding velocity to the grenade and letting roblox physics doing the work gives it a smooth arc, from what you've told me the grenade follows a set of points to get to it's target?
Oh, I see now... what would ya recommend? ANOTHER SOLUTION is to lower the gravity of the grenade with a bodyforce to get it to bounce higher. Or you can raise the elasticity of the grenade to get it bounce higher. |
|
|
| Report Abuse |
|
|
|
| 16 Jul 2015 07:02 PM |
"Just adding velocity to the grenade and letting roblox physics doing the work gives it a smooth arc, from what you've told me the grenade follows a set of points to get to it's target?" Physics? Well if am using raycasting for the arch then am hardly gonna use physics :P
"ANOTHER SOLUTION is to lower the gravity of the grenade with a bodyforce to get it to bounce higher. Or you can raise the elasticity of the grenade to get it bounce higher." Bounce higher? o.O
"My Life is going Good... but..." |
|
|
| Report Abuse |
|
|