Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (use Double)
- (use IO)
- (load "Vector.carp")
- (use Vector2) ;; HERE
- (defmodule AABB2
- (deftype Box
- [center V2
- hwidth Double
- hheight Double])
- ;;...
- (defn corners
- [b]
- (let [center (Box.center b)
- hwidth @(Box.hwidth b)
- hheight @(Box.hheight b)
- tl (V2.init (- (get-x center) hwidth) (+ (get-y center) hheight)) :: HERE V2.init works fine
- tr (V2.init (+ (get-x center) hwidth) (+ (get-y center) hheight))
- bl (V2.init (- (get-x center) hwidth) (- (get-y center) hheight))
- br (V2.init (+ (get-x center) hwidth) (- (get-y center) hheight))]
- [tl tr bl br]))
- )
- (use AABB2)
- (defmodule Collision
- ;;...
- (defn mtv
- [b1 b2]
- (let [x-dist (if (< (get-x (Box.center b1)) (get-x (Box.center b2)))
- (* -1.0 (abs (- (x-max b1) (x-min b2))))
- (abs (- (x-max b2) (x-min b1))))
- y-dist (if (< (get-y (Box.center b1)) (get-y (Box.center b2)))
- (* -1.0 (abs (- (y-max b1) (y-min b2))))
- (abs (- (y-max b2) (y-min b1))))]
- (if (< x-dist y-dist)
- (Vector2.V2.init x-dist 0.0) ;; PROBLEM HERE: Trying to refer to an undefined symbol 'V2.init' at line 106, column 10 in '/home/jallen/dev/carp/collision/collision.carp'. if just V2.init
- (Vector2.V2.init 0.0 y-dist))))
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement