Beam Weapon Collsion Detection

This forum is currently in read-only mode.
From the Asset Store
Futuristic Weapons Vol 1
$7.20 USD
40% off
Futuristics Weapons Vol 1 includes 8 different weapons, in a total of 216 sounds
  • Hey, I'm making a beam weapon and it's length needs to be rather long 10000+ pixles.

    And it's needs to cut down it's length if it hits an object.

    I can do this: collision with blah blah: set width to distance(x1, x2, y1, y2) etc.

    The problem is when it is a near miss the frame rate chugs down to less than 1! I know, my laptop, not a gaming machine.

    But I was wondering if there was any better way to do it. Angle detection or something. Any ideas?

  • Any chance of uploading your cap, or even a complied exe? I can then check it on my systems and see if there is similar slow-down, then try to find out why it's doing it.

    ~Sol

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • yeah, I can't get to it tonight but I'll get it up.

    thanks

  • What on earth do you need a 10,000 long object for? There should be a laser/instant hit beam example in the uploads forum - done using instant hit bullets, which are much faster for stepping and testing collisions. My guess is you gradually change the size of the beam and test collisions, which means it has to go through a fairly CPU intensive collision mask generation. If you use a single detector object which does not change width, height or angle, it never needs to do that.

    You should still destroy the object if it goes offscreen, to prevent wasted CPU time testing it offscreen.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)