1

(4 replies, posted in General)

hm. found where to set up compiling as release - now it works.
one question. how to set the path same as project in XCode? it is grey and locked to /Users/felis/Library/Developer/Xcode/DerivedData/Game-dwxnmodzsruyeucahwkppvyvpone/Build/Products/Release/Game.dylib

2

(4 replies, posted in General)

nothing happens also. i don't see any new behaviors in SimpleGamePlugin example. and same fish locations in WaterGameDemp...

3

(4 replies, posted in General)

welcome new noob. i've never programmed on C/C++ before and want to learn it. also interested in game engine, so want to learn some examples.
Installed XCode on OSX 10.7.5. open sources from WaterGameDemo and SimpleGamePlugin examples. fixed some links, compiled project - got game.dylib file
what next?..
no matter where i put it: /_GamePlugin/, or /GamePlugin/ or near the game itself - no difference...

4

(7 replies, posted in Scripting)

ok. here what i managed to make:

box = getObject("Entity6")
camera = getObject("Camera0")
RAYDIST = 500 -- distance to click the objects in game units
fov = getCameraFov(camera)
    
-- scene update
function onSceneUpdate()
    
    -- mouse click objects
    if onKeyDown("MOUSE_BUTTON1") then
        startPT = getPosition(camera) -- take camera position as start point
        -- now calculate end point by converting 3D vector to coordinates
                   camRot = getRotation(camera)
            camRotX = 180-camRot[1] -- corrected camera rotation from down to up (0-180 deg)
            camRotZ = 90+camRot[3] -- camera rotation left/right
           
            -- calculate angle of mouse cursor relative to camera
            mx = getAxis("MOUSE_X") - 0.5
            my = getAxis("MOUSE_Y") - 0.5
           
             mRotX = math.deg(math.asin(my / fov)) * fov
            mRotY = -math.deg(math.asin(mx / fov)) * fov * 1.75
           
            endPointX = RAYDIST * math.sin(math.rad(camRotX + mRotX)) * math.cos(math.rad(camRotZ + mRotY)) + startPT[1]
            endPointY = RAYDIST * math.sin(math.rad(camRotX + mRotX)) * math.sin(math.rad(camRotZ + mRotY)) + startPT[2]
            endPointZ = RAYDIST * math.cos(math.rad(camRotX + mRotX)) + startPT[3]
           
            endPT = {endPointX, endPointY, endPointZ}
            
            point = rayHit(startPT, endPT) -- trace to any object in given direction
            if point then
                setScale(box, {0.2, 0.2, 0.2})
                setPosition(box, {point[1], point[2], point[3]}) -- send scaled box there
            end

     end

end

but i have problem with mRotX and mRotY variables. it looks like camera have some lens distortion.

anyway, wait for that function. it will make this much easier smile

5

(7 replies, posted in Scripting)

trying to test in Jules example project. i've set camera to follow Jules closely. the problem is i cannot detect readable camera rotation.
what axises does getRotation() function returns?
my small code:
           camRot = getRotation(camera)
           camRotX = camRot[1]
           camRotY = camRot[2]
           camRotZ = camRot[3]
           print("camera rotation:", camRotX, camRotY, camRotZ)
it returns this:
camera rotation:    63.430767059326    -8.5377365621753e-07    19.999326705933
camera rotation:    63.430732727051    -8.5377359937411e-06    104.99935150146
camera rotation:    63.430698394775    1.7075473124351e-06    -150.00065612793
camera rotation:    63.430725097656    5.122642050992e-06    -35.000694274902

so i think results are:
camRotX is rotation of camera upward from the direct down (0) to up (180)
camRotY is camera tilt
camRotZ is camera rotation left/right

now to trigonometry...

6

(7 replies, posted in Scripting)

i think we can use rayHit() for detecting object's position by directing it to the camera and mouse vector, then put our "cursor" object there and check the object by isCollisionBetween().
of-course we will have to check all the "trigger" object, to find if we hit one of them.

7

(7 replies, posted in Scripting)

unfortunately i'm not C++ programmer and can make only simple scripts in Lua.
hope to see this function implemented in engine soon.

8

(1 replies, posted in Scripting)

in lot of examples here and in docs i see print(something) function is used. but where it outputs? is there any log file or onscreen output?
it could b really great for testing and debugging scripts if we have print() writing needed info into log.
thanx.

9

(7 replies, posted in Scripting)

same problem here.
i thought about rayHit(), but i'm not sure if it return name of hited object. and there will be some math to calculate hit vector, using mouse coordinates and camera orientation.
also i think about some ghost object as mouse pointer, but it will require the full list of objects in scene.