Screen Math - Direction Indicators / Object Mouse Move (UPBGE 0.3)

Welcome,

here are 3 different Scenes with Screen / Camera / Mouse - Scripts:

Welcome,

Indicator (indicator.py):
objects with property "indicate" == True are indicated

3 different Scenes:

1. Scene 1 Basics:  
Object Mouse Move (move.py):
Object is placed at mouse cursor at any Camera Transform and Type (Perspective/Orthographic) with their Camera Settings (lens, sensor_width /orthoscale)
Mousewheel: change position of object in z-direction of the Camera


2. Scene 2 Projection:
Object Mouse Move (move_projection.py):
    Object is placed at mouse cursor at any Camera Transform and Type (Perspective/Orthographic) and Camera Settings (lens, sensor_width /orthoscale)
    Mousewheel: change position of object in z-direction of the Camera
     
    if a Projection_Plane is given Object is projected onto it (infinitely)
    Mousewheel: change position of Projection-Plane in Normal direction
    
    You can also define your own plane by definig a position and a normal


3. Scene 3 Mouseclick:
Object Mouse Move (move_click.py):
    Objects with property "grab" == True can be moved
    Mouse-click Drag n drop
    Object is placed at mouse cursor at any Camera Transform and Type (Perspective/Orthographic) and Camera Settings (lens, sensor_width /orthoscale)
    Mousewheel: change position of object in z-direction of the Camera
     
    Static object: Cube moves according to clicked Face
    Dynamic and Rigid-body: Object moves left/right (according to Camera) and up/down along World-Z-Axis 
                            with holding SHIFT: Object moves relative to ground
                            with holding CTRL: Object rotates around World-Z-Axis 


Credits:
Positioning On-Screen Indicators to Point to Off-Screen Targets
https://code.tutsplus.com/positioning-on-screen-indicators-to-point-to-off-screen-targets--gamedev-6644t

UPBGE_0.3_screen_math.blend (1.2 MB)

indicator.py (in all Scenes):
Object out of View

indicator.py (in all Scenes):
Multiple Objects support

Scene 1 Basics:
Object Mouse Move

2 Likes

Scene 2 Projection:

1 Like

Scene 3 Mouseclick:

holding SHIFT: Object moves relative to ground
holding CTRL: Object rotates around World-Z-Axis

1 Like

Example Project here:

1 Like