How do you make "grenade-like" projectiles?

Post » Thu Jun 21, 2012 3:59 am

I want a projectile that is "lobber" that will actually bounce off of things. I need it to collide with anything collideable, but when I try to change the collision layer I often get projectiles that don't even move. I'm confused.
User avatar
Sophh
 
Posts: 3381
Joined: Tue Aug 08, 2006 11:58 pm

Post » Thu Jun 21, 2012 4:26 pm

I haven't been able to get this to work quite right using lobber either. I would suggest placing a potion-like object at the player, moving it to the hand node, then applying a havok impulse to it to throw it. Then, using onupdate, place an explosion at the object and delete it.
User avatar
Anthony Diaz
 
Posts: 3474
Joined: Thu Aug 09, 2007 11:24 pm

Post » Thu Jun 21, 2012 1:28 am

Two things:
a) How does one move an object to a node? As far as I'm aware the only function that targets nodes is SplineTranslateToRefNode, which would work but might look awkward.
B) When should I do the update? There is no "impact" function as far as I'm aware...
User avatar
Dagan Wilkin
 
Posts: 3352
Joined: Fri Apr 27, 2007 4:20 am

Post » Thu Jun 21, 2012 4:33 am

Well if you want the projectile to explode on impact then just use a projectile. If you want it to bounce around and explode after say, 3 seconds, then do placeatme, movetonode, applyhavokimpulse, and registerforsingleupdate(3.0). With some other functions mixed in to get the direction the player is facing and whatnot, then place an explosion at the object you just threw, which could be an activator with say, a potion model. You may need to play with setmass also, to get it to.fly and bounce nicely.
User avatar
Tiff Clark
 
Posts: 3297
Joined: Wed Aug 09, 2006 2:23 am

Post » Thu Jun 21, 2012 10:12 am

Well if you want the projectile to explode on impact then just use a projectile. If you want it to bounce around and explode after say, 3 seconds, then do placeatme, movetonode, applyhavokimpulse, and registerforsingleupdate(3.0). With some other functions mixed in to get the direction the player is facing and whatnot, then place an explosion at the object you just threw, which could be an activator with say, a potion model. You may need to play with setmass also, to get it to.fly and bounce nicely.

Yeah, I was hoping to get it to trigger whenever it hit something, but its not necessary. I can just as easily have it land and then do it, and it would be more like the show...
Remember the Pokemon mod in Oblivion that let you catch people? I'm re-making that. Getting the pokeball to render properly is the hard part, and I had the lobber working proerly other than collision, but now it's wonky. Probably best to just do as you say.
User avatar
Jessica Phoenix
 
Posts: 3420
Joined: Sat Jun 24, 2006 8:49 am

Post » Thu Jun 21, 2012 2:43 am

You could use a while loop that does findclosestactor to ref in a small radius around the thrown pokeball, and then if it finds one, do the onupdate stuff immediately. That is a bit hacky but it should work
User avatar
danni Marchant
 
Posts: 3420
Joined: Sat Oct 07, 2006 2:32 am

Post » Thu Jun 21, 2012 8:40 am

One quick thing, is there somewhere online that details standard names of nodes? I haven't been able to figure out Beth's naming conventions with nodes.

EDIT: Never mind, figured out how to get that information.

Now I've got two more small issues.
1) whatever side faces the light on my pokeballs do not show the texture. As I roll them around, the texture remains always on the bottom as the mesh rolls normally.
2) also, this script:
Scriptname PokeBallThrower extends activemagiceffect MiscObject Property PokeBallBowl autoevent OnEffectStart(Actor Target, Actor Caster)ObjectReference PokeBall = Caster.PlaceAtMe(PokeBallBowl,1,false,true)PokeBall.MoveToNode(Caster, "NPC R Hand [RHnd]")PokeBall.Enable()	   PokeBall.ApplyHavokImpulse(Caster.GetAnglex(),Caster.GetAngleY(), Caster.GetAngleZ() +-90, 30.00)PokeBall.RegisterForSingleUpdate(3)endEvent

Properly spawns a pokeball, but where it goes is extremely inconsistent, and usually its straight up in the air. anyone know a fix?
User avatar
Ray
 
Posts: 3472
Joined: Tue Aug 07, 2007 10:17 am

Post » Thu Jun 21, 2012 12:22 pm

Can anyone tell me how to change the above script to make it actually throw an object forward from the player in a straight line. I'm not so good at geometry.
User avatar
Brad Johnson
 
Posts: 3361
Joined: Thu May 24, 2007 7:19 pm

Post » Thu Jun 21, 2012 3:45 pm

PokeBall.ApplyHavokImpulse(Math.Sin(Caster.GetAngleZ()), Math.Cos(Caster.GetAngleZ()), 0, afMagnitude)
User avatar
danni Marchant
 
Posts: 3420
Joined: Sat Oct 07, 2006 2:32 am

Post » Thu Jun 21, 2012 12:20 pm

That worked, the only unfortunate part is that no matter where the player looks as far as up and down, the ball is thrown from the chest outward. I wound up doing this:
PokeBall.ApplyHavokImpulse(Math.Sin(Caster.GetAngleZ()), Math.Cos(Caster.GetAngleZ()), Math.cos(Caster.GetAngleX()), 35.0)
and it works great! Thank you.
User avatar
megan gleeson
 
Posts: 3493
Joined: Wed Feb 07, 2007 2:01 pm

Post » Thu Jun 21, 2012 1:22 pm

I actually think using (negative) sin for the z component is better than cos, but whatever works. :smile:
User avatar
helen buchan
 
Posts: 3464
Joined: Wed Sep 13, 2006 7:17 am

Post » Thu Jun 21, 2012 9:51 am

You can check out my fishing/dynamite mod http://steamcommunity.com/sharedfiles/filedetails/?id=39990763 which has a lot of the rotation/physics junk already done in it, particularly calculations of angle and application of impetus force based on vertical angle - look at feet, drop item, look straight up, throw as hard as you can.
User avatar
JaNnatul Naimah
 
Posts: 3455
Joined: Fri Jun 23, 2006 8:33 am


Return to V - Skyrim