Recording impact position of projectile?

Post » Mon Nov 19, 2012 1:27 am

I am in need of being able to fire a projectile and recording where it lands (x, y, z position). Is there a known way of doing this?

This seems so simple but I've run into a brick wall on this.
User avatar
Brιonα Renae
 
Posts: 3430
Joined: Mon Oct 22, 2007 3:10 am

Post » Mon Nov 19, 2012 6:01 am

Try having an explosion (zero damage, zero visible effect) associated with the projectile, and have a Placed Object associated with the explosion. The placed object can be an activator with a script (perhaps with just an OnLoad event handler?) which notes its own X, Y and Z and handles these or records them for something else to handle.

A problem I ran into with my hoverchair mod is that some projectiles (bullets) worked fine, even when fired using the FireWeapon command. Others (rockets) would only detect and 'hit' objects if they were in the same cell as the player - when fired using FireWeapon, that is. For those I had to have an activator that looked like a rocket and moved itself with scripting, and a zero-damage bullet that 'painted' the location of the intended target using the method above, so the fake rocket could blow up when it reached sort-of-approximately the right position.

That little anecdote isn't directly relevent to Skyrim and Papyrus, but may serve to help you recognise weird game engine issues when they crop up, and to think of maybe-possible workarounds.

[edited for greater clarity]
User avatar
evelina c
 
Posts: 3377
Joined: Tue Dec 19, 2006 4:28 pm

Post » Mon Nov 19, 2012 2:16 am

Thanks andyw!

I will try the method specified. I am using this to try to calculate the average slope of a small bit of terrain by shooting some projectiles from the sky down to the ground, recording their positions (they form a triangle when looked at from above), and using their Z positions, calculate the slope of the 3D polygon. I can use this to place campsite items (tents, campfires) that follow the terrain instead of sticking out on occasion.
User avatar
Sammi Jones
 
Posts: 3407
Joined: Thu Nov 23, 2006 7:59 am

Post » Mon Nov 19, 2012 11:32 am

Another, slightly off-the-wall idea... can the placed object just drop using Havok physics, then have a script that reads off it's own X,Y,Z rotation? If that would work it'd be 1/3rd as many objects and no trigonometry - unless you happen to like trigonometry :D.

No idea if a placed object can have physics set up right, but it might be worth the experiment :shrug:.
User avatar
Soraya Davy
 
Posts: 3377
Joined: Sat Aug 05, 2006 10:53 pm

Post » Mon Nov 19, 2012 1:02 am

It would get wonky because the object has to follow the view of the player, so you'll either have a campfire falling and hitting the ground repeatedly, or it'll start flying around / spazzing out. I'd rather do it with precision.
User avatar
herrade
 
Posts: 3469
Joined: Thu Apr 05, 2007 1:09 pm

Post » Sun Nov 18, 2012 11:14 pm

Ah, no, I meant the Placed Object, placed by the explosion at the point of projectile impact. It would be invisible, and could have the physics settings tweaked in the .nif so it just settled to the ground at whatever angle the ground is there. When it's settled it would use it's own rotation to spawn the campsite items/s.

It might be more trouble than it's worth, but could be a different line of attack if the 3-point system runs into trouble.
User avatar
Multi Multi
 
Posts: 3382
Joined: Mon Sep 18, 2006 4:07 pm


Return to V - Skyrim