## Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
 Ambiera Forum > CopperCube > Help with CopperCube Lightgun Math
Author Text
 greeRegistered User Quote 2022-11-11 12:48:28

Hi all,
I'd like to recreate the old lightgun in coppercube.
For now I've set up a calibration screen which detects the offset by clicking in different areas.
BUT; how did the guyz back in the '80s/'90s did the calculations?
The mathematical routing behind it?

For now i've got this:
- Left/Right/Top/Bottom offset data

But how gets the math inbetween absolutes beeing calculated? For example; the center point should get all offsets; but the closer to the center it should be the overall average of all 4 offsets? I'm not a coder, you can tell - I'm sure I totally overthink it atm....

Maybe someone can enlighten me to become a matchstick :)
Thanks all

 okeokeRegistered User Quote 2022-11-11 14:51:19

Hi,

To tell the truth, I don't think there was a lot of math related to the light gun, if I understood what you're talking about correctly:)

The gun itself had a photosensor on its point. As you press the trigger, the screen turns black for a couple of frames. All sprites which could be shot, swapped to white hitboxes. So in case you point the gun, i.e. the photosensor to the area there the sprite was (to the white hitbox), photosensor detects light and outputs HIGH signal. In case you're pointing the gun outside the hitbox, i.e. to the black screen area photosensor output is LOW. Based on that output signal game console decides if the target is hit or not.

If you have multiple potential targets, the hit box appear one by one, i.e. the screen stays black for more frames.

 greeRegistered User Quote 2022-12-03 14:13:22

Thanks @okeoke - wasn't aware of the oldschool techniques :) awesome what they did back at that time

 Posted by: (you are not logged in) Enter the missing letter in: "Interna?ional" (you are not logged in) Text:

### Possible Codes

 Feature Code Link [url] www.example.com [/url] Bold [b]bold text[/b] Image [img]http://www.example.com/image.jpg[/img] Quote [quote]quoted text[/quote] Code [code]source code[/code]