Raised This Month: $ Target: $400
 0% 

How to create circle


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Smilex_Gamer
Senior Member
Join Date: Apr 2017
Location: Portugal
Old 09-24-2019 , 11:06   Re: How to create circle
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
Lmao I didn't think this through typing it, I mean I want create a circle in multiple directions and check if the player is in it lets say it's more like player inside cylinder I want to give width to that circle/cylinder I'm using this equation to detect how far the player from the circle in different axis (PlayerOriginX - circleCenterX )^2 + floatsqroot((PlayerOriginY - circleCenterY)^2)) < Radius

I'll post what I have tried after I come back from work.
First: A circle is 2D. A cylinder is 3D.
Maybe you're trying to know if a player is inside a sphere.
If that's so, the formula to know if something is inside that sphere is this one: (x - SphereCenterX)^2 + (y - SphereCenterY)^2 + (z - SphereCenterZ)^2 < Radius^2
If it's a circle, then it's: (x - CircleCenterX)^2 + (y - CircleCenterY)^2 < Radius^2

P.S: The only thing you got wrong in your formula was the radius that wasn't square rooted.
P.S.S: Of course, because Goldsource is a 3D game engine, your circle you create has a Z origin, so you should use the first formula in my comment.

Last edited by Smilex_Gamer; 09-24-2019 at 11:23.
Smilex_Gamer is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 17:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode