Beam Weapon Collsion Detection

For questions about using Classic.

Post » Mon Apr 20, 2009 2:08 am

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?
Follow me on Twitter @evgLabs
B
33
S
14
G
4
Posts: 251
Reputation: 4,049

Post » Mon Apr 20, 2009 4:11 am

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
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Mon Apr 20, 2009 4:19 am

yeah, I can't get to it tonight but I'll get it up.

thanks
Follow me on Twitter @evgLabs
B
33
S
14
G
4
Posts: 251
Reputation: 4,049

Post » Mon Apr 20, 2009 12:44 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,610


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests