Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → Measuring Distances
Measuring Distances
2005-07-18, 9:36 PM #1
Is there any way to find the distance from the player to the point on a wall (or thing) at the player's crosshair?

Help would be appreciated. I would be able to do many things with this.
visit my project

"I wonder to myself. Why? Simply why? Why why? Why do I ask why? Why do I need to find out why? Why do I have to ask why as a question? Why is why always used to find out why? Why is the answer to why always why? Why is there no final answer to why? Simply why not? Holy cow, this is pretty deep, meaningful **** I wrote. Glad I wrote it down. Oh man."
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ [slog], Echoman
2005-07-18, 10:08 PM #2
I'd say, make some FireProjectile which can be no 3do, real fast velocity from player.

On the removed message of it, just get that position and do VectorDist from the player position.
2005-07-18, 10:18 PM #3
Thanks, but moving projectiles seem to collide randomly with certain 3dos and that is pretty bad for what I have in mind. Though it doesn't have any problem with instant hitters like lightning and concblasts. Will an instant hitting projectile return its "hit" position with GetThingPos() in removed?
visit my project

"I wonder to myself. Why? Simply why? Why why? Why do I ask why? Why do I need to find out why? Why do I have to ask why as a question? Why is why always used to find out why? Why is the answer to why always why? Why is there no final answer to why? Simply why not? Holy cow, this is pretty deep, meaningful **** I wrote. Glad I wrote it down. Oh man."
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ [slog], Echoman
2005-07-18, 10:28 PM #4
I don't understand what you mean by randomly colliding.

Since I haven't edited cog in good 4 years, I MAY be wrong...but you can make your ghost bullet as non colliding and let it lose itself hitting world surfaces. It's all a matter of flag settings I guess.

And you don't need to do trailthing like lightning or concussion blasts, just a tiny small sized object, probably deriving from _weapon template should do ok.
2005-07-18, 10:35 PM #5
It's a matter of how you want it be, but if you make the object's size very very tiny so small like 0.001, it will have no chance of hitting, but if some 3do of a wall or something gets in the way, it sure does stop, but then again same goes to player's LOS.

If you absolutely need world surface then you should consider getting non collision flag on, but for the sake of testing, I bet having some colorful 3do at first gonna solve where the object goes and gets deleted.

And just give it a cog flag, (was it 0x400?) and a custom cog with removed message, and.

printvec(getthingpos(getsenderref()));

Edit : oh and vec=(0/100/0) in the template of the object makes it instant hit. No need for trailthing complication, though whose explosion template still does return touched message according to strifle stun shot in my enhacenment pack 2.1.
2005-07-18, 10:45 PM #6
When aiming at a thing, projectiles that move with vel=(x/y/z) seem to collide randomly somewhere between where they were fired and the 3do. I get this a lot with floating bulletholes in the mod I'm working on. The force lightning template doesn't seem to use any velocity and instantly hits where it's aimed.

I'm going to try to see if the removed message with an instant hitting projectile will give me the position it collides at.
visit my project

"I wonder to myself. Why? Simply why? Why why? Why do I ask why? Why do I need to find out why? Why do I have to ask why as a question? Why is why always used to find out why? Why is the answer to why always why? Why is there no final answer to why? Simply why not? Holy cow, this is pretty deep, meaningful **** I wrote. Glad I wrote it down. Oh man."
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ [slog], Echoman
2005-07-18, 10:49 PM #7
You can make a bright 3do on the projectile, maybe turn the hit thing into weegee 3do to see what hit it. Could be size is too big or the timer is too low.
2005-07-18, 11:31 PM #8
No, this is a JK error. It seems to be because of JK calculating physics in per frame. From what I've heard it only occurs with collide=3.
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2005-07-18, 11:38 PM #9
Quote:
Originally posted by ProdigyOddigy
When aiming at a thing, projectiles that move with vel=(x/y/z) seem to collide randomly somewhere between where they were fired and the 3do. I get this a lot with floating bulletholes in the mod I'm working on. The force lightning template doesn't seem to use any velocity and instantly hits where it's aimed.

I'm going to try to see if the removed message with an instant hitting projectile will give me the position it collides at.

It also happens with instant-hit projectiles. A point where it almost always happens is singleplayer level 1, in the hallway where there are two grans and a rodian. There's a ventshaft at the ceiling towards the end of the hallway (up there is another gran and 2 healthpacks). The door leads to an open area with a catwalk crossing an abyss. On the other side of the abyss are two barrels.
Now, if you fire a gun at the door from inside the hallway, the projectile may explode anywhere on the way to the door. The faster the projectile, the higher the randomxplosion rate.
"Häb Pfrässe, süsch chlepfts!" - The coolest language in the world (besides Cherokee)
2005-07-18, 11:54 PM #10
nevermind

I seem to have figured out a working code

Code:
      testthing1 = FireProjectile(player, measureprojectile, -1, -1, '0 100 0', '0 0 0', 1.0, 0x30, -1, -1);
      CaptureThing(testthing1);
      if((testthing1 != -1) && (testthing1 != jkGetLocalPlayer()))
      {
         DestroyThing(testthing1);
      }

   Return;

removed:
   if(GetSenderRef() == testthing1)
   {
      distanttarget = GetThingPos(GetSenderRef());
      thedistance = VectorDist(distanttarget, GetThingPos(player));
      PrintFlex(thedistance);
   }
   ReleaseThing(GetSenderRef());
   Return;

the measureprojectile is just a normal weapon template with raildet sticky flags, or else it seems to slide around the surface where it collides.

Thanks for helping anyway

I'll post it so others can see
visit my project

"I wonder to myself. Why? Simply why? Why why? Why do I ask why? Why do I need to find out why? Why do I have to ask why as a question? Why is why always used to find out why? Why is the answer to why always why? Why is there no final answer to why? Simply why not? Holy cow, this is pretty deep, meaningful **** I wrote. Glad I wrote it down. Oh man."
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ [slog], Echoman

↑ Up to the top!