whap2005 Posted March 19, 2007 Posted March 19, 2007 Hey guys, I'm currently building a terrain editor for a mmorpg. The program will allow me and my dev team to modify the height maps, textures, and splats in realtime. I'm having some trouble creating a perferct circle shape for the terrain "brush". Here is my code and a screenie of the shape I'm getting. Does anyone see anything obviously wrong with my furmula? This has been driving me nuts all day... Public Sub deformterrain(ByVal pointsize As Integer, ByVal pointheight As Single, ByVal mx As Single, ByVal my As Single, ByVal mz As Single, ByVal shape As Boolean) Dim ps As Integer ps = pointsize / 2 Pick = land(0).MousePick(mx, my) If Pick.IsCollision = True Then ImpactX = Pick.GetCollisionImpact.x ImpactZ = Pick.GetCollisionImpact.z ImpactY = land(0).GetHeight(ImpactX, ImpactZ) End If Dim fnlx As Integer Dim fnlz As Integer Dim theta As Single Dim dtheta As Single dtheta = 2 * Math.PI / pointsize theta = 0 For fnlz = -ps To ps theta = theta + dtheta For fnlx = ImpactX - pointsize To ImpactX + pointsize land(0).SetHeight(fnlx + pointsize * Math.Cos(theta), ImpactZ + pointsize * Math.Sin(theta), ImpactY + pointheight, True, True) Next Next land(0).FlushHeightChanges() End Sub
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now