;eXgp

(Load "defaultlisplib.lsp")

;(def x (LoadXPhBody "heart.x"))
;(def x (LoadXPhBody "para.x"))
;(SetXPhBodyPhysicsMode x 0)
;(XPhBodySetSameCGroupEachChild x)
;(SetXPhVertexTransformMat x '((2 0 0) (0 2 0) (0 0 2) (0 0 0)))
;(SetXPhBodyMat x '((1 0 0) (0 1 0) (0 0 1) (0 -5 0)))

;߂荞݋eʂ̐ݒ
(SetInterferencePermitDistance 0.1)

(SetCollisionSatisfyCoefficientScale 4.0f)
(GetCollisionSatisfyCoefficientScale)

(SetCollisionSpringCoeff 20.0)
(GetCollisionSpringCoeff)

(SetCollisionStaticFrictionCoeff 0.8)
(GetCollisionStaticFrictionCoeff)

(SetCollisionDynamicFrictionCoeff 0.7)
(GetCollisionDynamicFrictionCoeff)

(SetCollisionSatisfyRepeatMax 32)
(GetCollisionSatisfyRepeatMax)

(SetGravity 9.8)
(GetGravity)

(SetRetryCollisionMax 64)
(GetRetryCollisionMax)



(def z (LoadXPhBody "plate.x"))
(SetXPhBodyPhysicsMode z 0)
(SetXPhBodyMat z '((1 0 0) (0 1 0) (0 0 1) (0 -5 0)))
(SetXPhVertexTransformMat z '((5 0 0) (0 5 0) (0 0 5) (0 0 0)))

(def y (LoadXPhBody "heart.x"))
(SetXPhBodyMat y '((1 0 0) (0 1 0) (0 0 1) (0 5 0)))

(def f22 (LoadXPhBody "f22ld.x"))
(LoadXPhBodyVisual f22 "f22.x")
(SetXPhBodyMat f22 '((1 0 0) (0 1 0) (0 0 1) (0 10 0)))

(GetXPhBodyMat f22)

(XPhBodyGetVelocity f22)
(XPhBodySetVelocity f22 '(12 0 0))

(XPhBodyGetAVelocity f22)
(XPhBodySetAVelocity f22 '(0 0.5 0))


(def f22Mat (GetXPhBodyMat f22))
(def f22Mat (list (select f22Mat 0) (select f22Mat 1)
		 (select f22Mat 2) 
		(VAdd (select f22Mat 3) '(0 0 -20)))
)
(SetXPhCameraMat f22Mat)



(XPhBodyAddForce f22 
	'(0 300 0) 
	(select (GetXPhBodyMat f22) 3)
)




(defun func (this)
	(if (XPhBodyGetKeyState this 88)
		(XPhBodyAddForce this
			'(0 50 0) 
			(select (GetXPhBodyMat this) 3)
		)
		(XPhBodyAddForce this
			'(0 0 10) 
			(select (GetXPhBodyMat this) 3)
		)
	)
	;(def 'this nil)
	;(def aa ''this)
)
(XPhBodySetFunction f22 
		func
		;(list func ''f22)
)


(defun makehartandcons (x num)
	(SetXPhBodyMat x (list '(1 0 0) '(0 1 0)
			'(0 0 1) (list 0 (+ 22 (* 2 num)) 0)))
	(cons x (makehearts (- num 1)))
)

(defun makehearts (num)
	(if (= num 0)
		nil
		(makehartandcons (LoadXPhBody "heart.x") num)
	)
)

(def hearts (makehearts 5))



;(def f22 (LoadXPhBody "ewqrwer.x"))
;(LoadXPhBodyVisual f22 "werwerwer.x")


;(def x (LoadXPhBody "jointtest.x"))
;(SetXPhBodyPhysicsMode x 0)
;(XPhBodySetSameCGroupEachChild x)

(GetXPhCameraMat)

;(XPhBodyGetMass f22)
;(XPhBodySetMass f22 10.0)
;(XPhBodyGetMass f22)

;(XPhBodyGetInertiaTensor f22)
;(XPhBodySetInertiaTensor f22 '((5 1 1)(1 5 1)(1 1 5)))
;(XPhBodyGetInertiaTensor f22)

(def alist '((za 23) (zb "bb")))

(with alist
	(print za)
	(print zb)
	(def zb '("ta" "tb"))

)

alist

(progn
	(def xa 11)
	(def xa (* xa xa))
	(- xa 21)
)

