Home   Help Search Login Register  

Author Topic: A better way of updating a fast moving object's position  (Read 4169 times)

0 Members and 1 Guest are viewing this topic.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:A better way of updating a fast moving object's position
« Reply #15 on: 28 Feb 2005, 22:08:38 »
this a lot to read so i didn't bother just to make one correction, that is very important:
Quote
Results:
____Trial #__|_____downward speed (ms^-1)___
          1          |          12.6951                
          2          |          12.6270  
          3          |          12.6759            
          4          |          12.6276        
          5          |          12.6951        
          6          |          12.6178  
          7          |          12.6659    
          8          |          12.6659      
          9          |          12.6367    
          0          |          12.6367    
Average: 12.65

gravity is an accelleration. that ^ is velocity (speed). you got those numbers by assuming it went at a constant speed

the acceleration of gravity is about 9.604 m/s^2 (or something similar, i may be implementing some dislexia) in ofp
« Last Edit: 28 Feb 2005, 22:09:29 by Triggerhappy »

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:A better way of updating a fast moving object's position
« Reply #16 on: 01 Mar 2005, 00:54:51 »
lol, i should have been more clear about what i was doing with all that stuff.

Triggerhappy: as you know acceleration is the change in velocity per 'unit' time (ie 1 second.) So what the results say is, having let the object drop for 1 second, it attained a downwards velocity of 12.65 ms-1. So the change in velocity was 12.65 ms-1/1s. Vector is 12.65 down, units are ms-1/s = ms-2.

This wasn't accurate tho, as i didn't take air resistace into account, as i mentioned before.

HateR_Kint:
I pretty much said most of it in the first post, but i'll explain it in more detail here.

Working on a script. The script camcreates a bullet. The bullet moves a long a path, from a starting point towards an end point. This is designed to check for solid obsticles between the start and end, like a 'raytrace'. The problem lies in that the bullet travels so fast, it can go along way in the space of ~0.0001. Instead of doing a check this way and getting big inaccuracies, i was looking for another way. Cap suggested that, knowing the bullet's velocity and everything, we should be able to calc the point of impact simply by knowing how long it was in the air for. The problem with this is that actually timing the time using script is really unreliable.
The script itself is in a thread in the ideas board, started by Clees, called Urban Areas... Obsticles

So atm im looking for a better way to get the bullet's pos, right before it hits something.
« Last Edit: 01 Mar 2005, 00:56:22 by Fragorl »

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:A better way of updating a fast moving object's position
« Reply #17 on: 01 Mar 2005, 03:53:00 »
either way, the accelleration of gravity in ofp is approx. 9.6, so there has to be some flaw in your design. How do you know it was for exactly 1 sec? It would be fairly hard to implement that flawlessly through ofp script. much better to use a set distance and measure time, then calculate. I did that in trying to find the acc. of gravity, and got about 9.4 ish (average of about 200 trials ;D) then homefry (who i had been helping at the time) came by and told me that someone at the official forums (trustworthy ofcourse) told him it was approx. 9.6 (although, once again, i may be getting numbers mixed and its really 9.4;D)
anyway, thats gravity, so good luck with your script

Offline Roni

  • Members
  • *
  • Play the Game !
Re:A better way of updating a fast moving object's position
« Reply #18 on: 01 Mar 2005, 08:57:55 »
Hello

Just passing and thought that I'd throw in a quick two cents

00 <ka-ching !>  :)

Check ou the tute on the Laser Designator (it's in the Editors Depot somewhere).  Apparently this "weapon" creates a virtual spot on the map wherever the laser "dot" is calculated to be.  This dot is dynamically updated and can be used for all sorts of neat "raytracing" projects such as this.

AFAIK it doesn't check for building interects but I could be wrong - I haven't read the thing very closely  :P

Good luck with it.



Roni

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:A better way of updating a fast moving object's position
« Reply #19 on: 02 Mar 2005, 03:00:29 »
Triggerhappy:
Quote
there has to be some flaw in your design
almost definitely ;D
Quote
How do you know it was for exactly 1 sec?
I used this:
Create bullet, setpos, setvelocity [0,0,0]
~1
Get Velocity.
I've no way of knowing how accurate this was.
Quote
much better to use a set distance and measure time, then calculate.
How did you measure time, or distance? With script?
Quote
(average of about 200 trials )
Wow! Thats commitment.

Roni:
I considered that, but seems a bit difficult. Thanks for the 2c though :)

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:A better way of updating a fast moving object's position
« Reply #20 on: 06 Mar 2005, 01:48:43 »
I think I may have almost solved this... just need a little more help.
I tried using a smokeshell instead of a bullet. The smokeshell, of course, does *not* disappear when it hits something (like a bullet does), it simply falls to the ground. So i could easily check for when it stops using the line:
"_x==0" count (velocity _this)
This works quite well. The problem is, when it hits something, it *instantly* teleports to the ground below where it hits. So i get a _pos which is correct for x and y, but not z.

I read somewhere that ecp 1075 has 'bouncy' grenades- ie they hit somethig and bounce off again, they dont just instantly stick to the ground. So i was wondering, which simulation is this, and is there any object in stock ofp that would exhibit this behaviour? Preferably ammo, but anything might work.

Thanks!  :thumbsup:

Offline Fragorl

  • Coding Team
  • Former Staff
  • ****
Re:A better way of updating a fast moving object's position
« Reply #21 on: 07 Mar 2005, 06:36:10 »
OK- got it! ;D. Got the x/y length from start to the grenade's resting place, found this as a proportion of the total x/y length from start to finish, found this fraction of the total z change, added to initial z.

Thanks everyone for your input! If there's still a better way, tell me, but for the time being this method works really well :)

*Solved*