Skip to main content
Bumped by Community user
Bumped by Community user
appended answer 88527 as supplemental
Source Link
iKlsR
  • 43.7k
  • 12
  • 157
  • 190

I have a custom cursor, I need it for moving crosshairs. I have a moving ship that is only controlled with the keyboard, but in front of it are 2 empties. When I press the assigned key/button, 2 bullets come out. It works great. I also have it so that these empties turn when I move the mouse. Mouse/mouse movement - and - mouse/look. It works when firing the guns, I can move the mouse and the guns move. The problem that I am having, however, is that the cursor and the line of sight for the bullets don't line up. If I press the "reset" on the mouse/look actuator, the cursor will stay in the center while the bullets aim and move around freely. If I click off on the "reset" on the mouse/look actuator, it's better, but the cursor doesn't align to where I'm shooting. I can kind of fix this by forcing the cursor to the side, and it centers both of them for a little while, but after a minute or so, the two become separated once again. Is there a way to fix this?

This is how I have it set up right now:

Here's how the empty is set up for firing the guns: logic bricks

Here's how the cursor scene is set up, which needless to say is overlayed: BGE and python script

And this is what it's doing. Notice how the cursor is near center, but the bullets are firing off to the side?

problem in game

Basically, I want to know how do I link up the bullet line of sight with the custom cursor?


Update I have found a script that centers (well, a little off from center but that's preferable for me) the mouse upon starting.

import bge

bge.render.setMousePosition(int(bge.render.getWindowWidth() / 2.003), int(bge.render.getWindowHeight() / 3))

Sadly, the empties do not align to center the way that I want it to still. It still makes them shoot off to the side. Is there a way to fix this?

I have a custom cursor, I need it for moving crosshairs. I have a moving ship that is only controlled with the keyboard, but in front of it are 2 empties. When I press the assigned key/button, 2 bullets come out. It works great. I also have it so that these empties turn when I move the mouse. Mouse/mouse movement - and - mouse/look. It works when firing the guns, I can move the mouse and the guns move. The problem that I am having, however, is that the cursor and the line of sight for the bullets don't line up. If I press the "reset" on the mouse/look actuator, the cursor will stay in the center while the bullets aim and move around freely. If I click off on the "reset" on the mouse/look actuator, it's better, but the cursor doesn't align to where I'm shooting. I can kind of fix this by forcing the cursor to the side, and it centers both of them for a little while, but after a minute or so, the two become separated once again. Is there a way to fix this?

This is how I have it set up right now:

Here's how the empty is set up for firing the guns: logic bricks

Here's how the cursor scene is set up, which needless to say is overlayed: BGE and python script

And this is what it's doing. Notice how the cursor is near center, but the bullets are firing off to the side?

problem in game

Basically, I want to know how do I link up the bullet line of sight with the custom cursor?

I have a custom cursor, I need it for moving crosshairs. I have a moving ship that is only controlled with the keyboard, but in front of it are 2 empties. When I press the assigned key/button, 2 bullets come out. It works great. I also have it so that these empties turn when I move the mouse. Mouse/mouse movement - and - mouse/look. It works when firing the guns, I can move the mouse and the guns move. The problem that I am having, however, is that the cursor and the line of sight for the bullets don't line up. If I press the "reset" on the mouse/look actuator, the cursor will stay in the center while the bullets aim and move around freely. If I click off on the "reset" on the mouse/look actuator, it's better, but the cursor doesn't align to where I'm shooting. I can kind of fix this by forcing the cursor to the side, and it centers both of them for a little while, but after a minute or so, the two become separated once again. Is there a way to fix this?

This is how I have it set up right now:

Here's how the empty is set up for firing the guns: logic bricks

Here's how the cursor scene is set up, which needless to say is overlayed: BGE and python script

And this is what it's doing. Notice how the cursor is near center, but the bullets are firing off to the side?

problem in game

Basically, I want to know how do I link up the bullet line of sight with the custom cursor?


Update I have found a script that centers (well, a little off from center but that's preferable for me) the mouse upon starting.

import bge

bge.render.setMousePosition(int(bge.render.getWindowWidth() / 2.003), int(bge.render.getWindowHeight() / 3))

Sadly, the empties do not align to center the way that I want it to still. It still makes them shoot off to the side. Is there a way to fix this?

Bumped by Community user
Bumped by Community user
Bumped by Community user
deleted 37 characters in body; edited tags
Source Link
David
  • 49.7k
  • 40
  • 162
  • 318

I have a custom cursor, I need it for moving crosshairs. I have a moving ship that is only controlled with the keyboard, but in front of it are 2 empties. When I press the assigned key/button, 2 bullets come out. It works great. I also have it so that these empties turn when I move the mouse. Mouse/mouse movement - and - mouse/look. It works when firing the guns, I can move the mouse and the guns move. The problem that I am having, however, is that the cursor and the line of sight for the bullets don't line up. If I press the "reset" on the mouse/look actuator, the cursor will stay in the center while the bullets aim and move around freely. If I click off on the "reset" on the mouse/look actuator, it's better, but the cursor doesn't align to where I'm shooting. I can kind of fix this by forcing the cursor to the side, and it centers both of them for a little while, but after a minute or so, the two become separated once again. Is there a way to fix this?

This is how I have it set up right now:

Here's how the empty is set up for firing the guns: enter image description herelogic bricks

Here's how the cursor scene is set up, which needless to say is overlayed: enter image description hereBGE and python script

And this is what it's doing. Notice how the cursor is near center, but the bullets are firing off to the side?

enter image description hereproblem in game

Basically, I want to know how do I link up the bullet line of sight with the custom cursor?

I have a custom cursor, I need it for moving crosshairs. I have a moving ship that is only controlled with the keyboard, but in front of it are 2 empties. When I press the assigned key/button, 2 bullets come out. It works great. I also have it so that these empties turn when I move the mouse. Mouse/mouse movement - and - mouse/look. It works when firing the guns, I can move the mouse and the guns move. The problem that I am having, however, is that the cursor and the line of sight for the bullets don't line up. If I press the "reset" on the mouse/look actuator, the cursor will stay in the center while the bullets aim and move around freely. If I click off on the "reset" on the mouse/look actuator, it's better, but the cursor doesn't align to where I'm shooting. I can kind of fix this by forcing the cursor to the side, and it centers both of them for a little while, but after a minute or so, the two become separated once again. Is there a way to fix this?

This is how I have it set up right now:

Here's how the empty is set up for firing the guns: enter image description here

Here's how the cursor scene is set up, which needless to say is overlayed: enter image description here

And this is what it's doing. Notice how the cursor is near center, but the bullets are firing off to the side?

enter image description here

Basically, I want to know how do I link up the bullet line of sight with the custom cursor?

I have a custom cursor, I need it for moving crosshairs. I have a moving ship that is only controlled with the keyboard, but in front of it are 2 empties. When I press the assigned key/button, 2 bullets come out. It works great. I also have it so that these empties turn when I move the mouse. Mouse/mouse movement - and - mouse/look. It works when firing the guns, I can move the mouse and the guns move. The problem that I am having, however, is that the cursor and the line of sight for the bullets don't line up. If I press the "reset" on the mouse/look actuator, the cursor will stay in the center while the bullets aim and move around freely. If I click off on the "reset" on the mouse/look actuator, it's better, but the cursor doesn't align to where I'm shooting. I can kind of fix this by forcing the cursor to the side, and it centers both of them for a little while, but after a minute or so, the two become separated once again. Is there a way to fix this?

This is how I have it set up right now:

Here's how the empty is set up for firing the guns: logic bricks

Here's how the cursor scene is set up, which needless to say is overlayed: BGE and python script

And this is what it's doing. Notice how the cursor is near center, but the bullets are firing off to the side?

problem in game

Basically, I want to know how do I link up the bullet line of sight with the custom cursor?

Bumped by Community user
Source Link

Blender Game - How do I start the game with the cursor centered?

I have a custom cursor, I need it for moving crosshairs. I have a moving ship that is only controlled with the keyboard, but in front of it are 2 empties. When I press the assigned key/button, 2 bullets come out. It works great. I also have it so that these empties turn when I move the mouse. Mouse/mouse movement - and - mouse/look. It works when firing the guns, I can move the mouse and the guns move. The problem that I am having, however, is that the cursor and the line of sight for the bullets don't line up. If I press the "reset" on the mouse/look actuator, the cursor will stay in the center while the bullets aim and move around freely. If I click off on the "reset" on the mouse/look actuator, it's better, but the cursor doesn't align to where I'm shooting. I can kind of fix this by forcing the cursor to the side, and it centers both of them for a little while, but after a minute or so, the two become separated once again. Is there a way to fix this?

This is how I have it set up right now:

Here's how the empty is set up for firing the guns: enter image description here

Here's how the cursor scene is set up, which needless to say is overlayed: enter image description here

And this is what it's doing. Notice how the cursor is near center, but the bullets are firing off to the side?

enter image description here

Basically, I want to know how do I link up the bullet line of sight with the custom cursor?

1
2