Is the box (projectile) just a create cube you are making and the phyproj is its body? if you parent those you shouldn't have to set the position for both... Also, try AddForce instead of AddForceAtPoint.
Try this and see if it helps:
require("Scripts/constants/keycodes")
require("Scripts/math/math")
RegisterAbstractPath("")
Graphics(800,600)
fw=CreateFramework()
light = CreateDirectionalLight()
light:SetRotation(Vec3(45,45,45))
camerapitch=fw.main.camera.rotation.x
camerayaw=fw.main.camera.rotation.y
HideMouse()
MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2)
DebugPhysics(1)
while KeyHit(KEY_ESCAPE)==0 do
gx=Round(GraphicsWidth()/2)
gy=Round(GraphicsHeight()/2)
dx=Curve((MouseX()-gx)/4.0,dx,3.0/AppSpeed())
dy=Curve((MouseY()-gy)/4.0,dy,3.0/AppSpeed())
MoveMouse(gx,gy)
camerapitch=camerapitch+dy
camerayaw=camerayaw-dx
camerapitch=math.min(camerapitch,90)
camerapitch=math.max(camerapitch,-89.99)
fw.main.camera:SetRotationf(camerapitch,camerayaw,0,1)
if MouseHit(1)==1 then
phyproj = CreateBodyBox(1,1,1)
projectile = CreateCube(phyproj)
projectile:SetColor(Vec4(math.random(0,255)/255,math.random(0,255)/255,math.random(0,255)/255,1))
phyproj:SetMass(1)
local V = TFormVector(Vec3(0, 0, 2), fw.main.camera, nil)
V = Vec3(fw.main.camera.position.x + V.x, fw.main.camera.position.y + V.y, fw.main.camera.position.z + V.z)
PositionEntity(phyproj, V, 0)
RotateEntity(phyproj, EntityRotation(fw.main.camera, 0), 0)
phyproj:AddForcef(0, 100, 1500, 0)
end
fw:Update()
fw:Render()
DrawText("Press left mouse button to fire a cube",0,40)
Flip(0)
end
ShowMouse()