CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 13:13:54 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=2ec33004c8be65a23882b67f1887fdd7c858bb6dce14ce227120f57e0fb37436a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%221nBsYFPW2gYH1F37MxM_SQvR2osuqqWI%22%3B%7D; HttpOnly; Path=/
cf-ray: 98ce9e0eea0eea32-BLR
Line/Circle Collision/Response - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "fbgfx.bi"
- const as integer scr_w = 800, scr_h = 600
- screenres scr_w, scr_h,32,,FB.GFX_HIGH_PRIORITY
- type vec2f
- x as single
- y as single
- end type
- declare function vec2f_perp( byref a as vec2f, b as vec2f ) as vec2f
- declare function cPointline( byref va as vec2f, byref vb as vec2f, byref vPoint as vec2f ) as vec2f
- declare sub vec2f_normalize( byref v as vec2f )
- declare function vec2f_len( byref v as vec2f ) as single
- declare function vec2f_dot( byref a as vec2f, byref b as vec2f ) as single
- declare function vec2f_dist( byref va as vec2f, byref vb as vec2f ) as single
- dim as vec2f Pl, Pld, Cent, Ero
- dim as single Radius, tDist
- dim as double deltaTime = timer, curTime = timer
- dim as integer i, ip1, Num_Verts
- pl = type(scr_w\2, scr_h\2)
- Radius = 32
- read Num_Verts
- dim Lines(Num_Verts) as vec2f
- for i = 0 to ubound(Lines)
- read Lines(i).X, Lines(i).Y
- next
- curTime = timer
- do
- deltaTime = timer-curTime
- curTime = timer
- var moveSpeed = 350*deltaTime
- if multikey(FB.SC_LEFT) then PlD.X -= moveSpeed
- if multikey(FB.SC_RIGHT) then PlD.X += moveSpeed
- if multikey(FB.SC_UP) then PlD.Y -= moveSpeed
- if multikey(FB.SC_DOWN) then PlD.Y += moveSpeed
- PlD.X += (-PlD.X*.95)*deltaTime
- PlD.Y += (-PlD.Y*.95)*deltaTime
- Pl.X+=PlD.X*deltaTime
- Pl.Y+=PlD.Y*deltaTime
- screenlock
- line(0,0)-(scr_w-1, scr_h-1),0,bf
- for i=0 to ubound(Lines)-1 step 2
- ip1 = i+1
- Cent = vec2f_perp( Lines(i), Lines(ip1) )
- Ero = cPointline( Lines(i), Lines(ip1), PL )
- tDist = vec2f_Dist( Pl, Ero )
- if tDist<Radius then
- Pl.X+=Cent.X*(Radius-tDist)
- Pl.Y+=Cent.Y*(Radius-tDist)
- end if
- line(Lines(i).X, Lines(i).Y)-(Lines(ip1).X, Lines(ip1).Y),&hffffff00
- line(Ero.X, Ero.Y)-(Ero.X + (Cent.X*Radius), Ero.Y + (Cent.Y*Radius)),&hffffffff
- next
- circle (Pl.X,Pl.Y),Radius, &hffffff00
- pset (Pl.X,Pl.Y), &hffffff00
- screensync
- screenunlock
- sleep 30,1
- loop until multikey(FB.SC_ESCAPE)
- function cPointline( byref va as vec2f, byref vb as vec2f, byref vPoint as vec2f ) as vec2f
- dim as vec2f tVector1
- dim as vec2f tVector2
- dim as vec2f vReturn
- dim as single d
- dim as single t
- tVector1.X = VPoint.X - Va.X
- tVector1.Y = VPoint.Y - Va.Y
- tVector2.X = Vb.X - Va.X
- tVector2.Y = Vb.Y - Va.Y
- vec2f_normalize( tVector2 )
- d = vec2f_dist( vA, vB )
- t = vec2f_dot( tVector2, tVector1 )
- if t<=0 then return Va
- if t>=d then return Vb
- vReturn.X = Va.X + (tVector2.X * t)
- vReturn.Y = Va.Y + (tVector2.Y * t)
- return vReturn
- end function
- function vec2f_dist( byref va as vec2f, byref vb as vec2f ) as single
- dim as single dx
- dim as single dy
- dx = va.X - vb.X
- dy = va.Y - vb.Y
- return sqr(dx^2+dy^2)
- end function
- sub vec2f_normalize( byref v as vec2f )
- dim as single vLen
- vLen = vec2f_len ( v )
- v.x /= vLen
- v.y /= vLen
- end sub
- function vec2f_len( byref v as vec2f ) as single
- dim as single tLen
- tLen = sqr(v.x^2 + v.y^2)
- if tLen = 0 then tLen = 1
- return tLen
- end function
- function vec2f_dot( byref a as vec2f, byref b as vec2f ) as single
- return a.x*b.x + a.y*b.y
- end function
- function vec2f_perp( byref a as vec2f, byref b as vec2f ) as vec2f
- dim as single vLen
- dim as vec2f d
- d.x = b.x - a.x
- d.y = b.y - a.y
- vLen = vec2f_len( d )
- return type( d.y / vLen, -d.x / vLen )
- end function
- data 21
- data 50,70
- data 10,240
- data 10,240
- data 100,340
- data 100,340
- data 125,400
- data 125,400
- data 300,450
- data 300,450
- data 450,470
- data 450,470
- data 600,370
- data 600,370
- data 550,300
- data 550,300
- data 625,250
- data 625,250
- data 500,10
- data 500,10
- data 320,50
- data 320,50
- data 50,70
Advertisement
Add Comment
Please, Sign In to add comment
-
⭐✅ Marketplace Glitch ✅ Working ✅ NEVER SEEN...
JavaScript | 6 sec ago | 0.24 KB
-
⭐⭐Exchange Exploit⭐⭐ 1
JavaScript | 6 sec ago | 0.24 KB
-
✅⭐ Make $2500 in 15 minutes ✅ NEVER SEEN BEFO...
JavaScript | 15 sec ago | 0.24 KB
-
✅⭐ Make huge profits on trading ⭐⭐ A
JavaScript | 17 sec ago | 0.24 KB
-
⭐⭐⭐Crypto Accounts⭐⭐
Java | 24 sec ago | 0.10 KB
-
⭐ Instant BTC Profit Method ✅ NEVER SEEN BEFO...
JavaScript | 29 sec ago | 0.24 KB
-
⭐⭐⭐Profit Method⭐⭐
Java | 36 sec ago | 0.10 KB
-
⭐✅ MAKE $2000 INSTANTLY ✅ NEVER SEEN BEFORE ⭐...
JavaScript | 38 sec ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand