Coder Social home page Coder Social logo

Smoke detonate position about demofile HOT 6 CLOSED

saul avatar saul commented on August 22, 2024
Smoke detonate position

from demofile.

Comments (6)

saul avatar saul commented on August 22, 2024

Yes, the .x and .y event variables should be correct. What is it that you're seeing? I've got a feeling that map is de_mirage and so your scale and pos_x are undefined?

from demofile.

jnettome avatar jnettome commented on August 22, 2024

Thank you for your quick response :)

So, I think I'm doing most of the things right. The parser code for player positioning is:

demoFile.on('tickend', e => {
  for(var i = 0; i < cts.members.length; i++) {
    var temp = {};
    temp.position = cts.members[i].position;
    temp.angle = cts.members[i].eyeAngles.yaw;
    currentTick.positions.push(temp);
  }
  game.playersPositioning.push(currentTick);
});

and for smoke detonate positions:

demoFile.gameEvents.on('smokegrenade_detonate', e => {
  var temp = {};
  temp.eventName = 'smokegrenade_detonate';
  temp.position = { x: e.x, y: e.y, z: e.z };
  pushEventToTick(temp, demoFile.currentTick);
});

Then, on my overview map, to draw the players positions I'm using the overviewData offsets and is working great:

var positionX = (entity.position.x - overviewData[map].pos_x) / overviewData[map].scale;
var positionY = (overviewData[map].pos_y - entity.position.y) / overviewData[map].scale;
var angle = 180 - (entity.angle ? entity.angle : 0);

BUT to draw the grenades, idk why they're all in wrong positions (like reaaaally far from the expected);

var positionX = (entity.position.x - overviewData[map].pos_x) / overviewData[map].scale;
var positionY = (overviewData[map].pos_y - entity.position.y) / overviewData[map].scale;

Same code but wrong positions. :(

(about your comment, var map = "mirage")

from demofile.

jnettome avatar jnettome commented on August 22, 2024

My dump file:

{
   "tick": 23821,
   "events": [
      {
         "eventName": "smokegrenade_detonate",
         "playerId": 94,
         "entityId": 206,
         "position": {
            "x": 353.3122253417969,
            "y": -1467.674560546875,
            "z": -173.96875
         }
      }
   ],
   "positions": [
     {
        "steamId": "76561197997532975",
        "playerId": 94,
        "position": {
           "x": -679.7399291992188,
           "y": -1919.3240966796875,
           "z": -179.96875
        },
        "angle": 250.9991455078125,
        "hp": 100,
        "armor": 100,
        "flashDuration": 0
     }
   ]
},

from demofile.

saul avatar saul commented on August 22, 2024

What code are you using to draw the positions on the overview? Have you tried doing “setpos” in-game to move to the grenade detonation locations to see if they’re correct?

from demofile.

jnettome avatar jnettome commented on August 22, 2024

I didn't yet but I will check asap! Thank you on that tip. I'll post my advances here.

from demofile.

jnettome avatar jnettome commented on August 22, 2024

Pure mathematics and confusion with Phaser.js :)
Everything is working as expected @saul

Thank you!

from demofile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.