This is the current code. I will uploade a ZIP file with the executable inside.
MouseX# = MouseX()
MouseY# = MouseY()
SphereX# = Object Position X(Game_Sphere)
SphereY# = Object Position Y(Game_Sphere)
SphereZ# = Object Position Z(Game_Sphere)
Collide = SC_RaycastGroup(0,Camera.Xpos,Camera.Ypos,Camera.Zpos,SphereX#,SphereY#,SphereZ#,0)
Distance# = SC_GetCollisionDistance()
pick screen MouseX#, MouseY#, Distance#
WorldPosX# = get pick vector x() + Camera.Xpos
WorldPosY# = get pick vector y() + Camera.Ypos
WorldPosZ# = get pick vector z() + Camera.Zpos
Position object Game_Sphere,WorldPosX#,WorldPosY#,WorldPosZ#
I'm using "Control Camera Using ArrowKeys 0,10,10"
When pressing the upkey or downkey , the Camera.Xpos changes to something unlimited. The sphere is flickering, changes from unlimited range to the collision range. And, when the sphere is not flickering the Y-Height of the placed object change every time you place something by a very small amount. The sphere height is not correct.
Press "Space" to go up and "C" to go down. Use the mouse to move the sphere around, use the up and down key to move the camera. And "W" to place an object.
Press "E" to increase the Xposition of the plane, and "Q" to decrease the position.
Using "SC_GetCollisionSlideY()" is not working, it will be placed at an unlimited range.
This is the best result so far :
Rem - Set the variables
MouseX# = MouseX()
MouseY# = MouseY()
SphereX# = Object Position X(Game_Sphere)
SphereY# = Object Position Y(Game_Sphere)
SphereZ# = Object Position Z(Game_Sphere)
Distance_1# = 50000
Pick Screen MouseX#,MouseY#,Distance_1#
A# = get pick vector x() + Camera.Xpos
B# = get pick vector Y() + Camera.Ypos
C# = get pick vector Z() + Camera.Zpos
Print Distance_1#
Print A#
Print B#
Print C#
Collide = SC_RaycastGroup(0,Camera.Xpos,Camera.Ypos,Camera.Zpos,A#,B#,C#,0)
Distance# = SC_GetCollisionDistance()
pick screen MouseX#, MouseY#, Distance#
WorldPosX# = get pick vector x() + Camera.Xpos
WorldPosY# = get pick vector y() + Camera.Ypos
WorldPosZ# = get pick vector z() + Camera.Zpos
``If Collide > 0
Position object Game_Sphere,WorldPosX#,SC_GetCollisionSlideY(),WorldPosZ#
`Else
`Position Object Game_Sphere,WorldPosX#,WorldPosY#,WorldPosZ#
`Endif
Checking collision between the 2D -> 3D mouse coordinates and 50.000 units away from it (High value to make sure it can not get above the terrain).
The objects place at the correct height.