Jump to content

bigd

Members
  • Content count

    18
  • Joined

  • Last visited

Everything posted by bigd

  1. Hi Karl - I figured I'd just create a new thread around the topic of the runtime API. I started diving in today and I figured the first problem I would tackle is creating a 3D translate / rotate / scale widget for manipulating probuilder object during runtime, similar to how it's done with the editor. Seems like the first step would be to detect the center of the selected face and place the 3d widget there, and handle drag events for the actual movement of vertrices. Any functions you can think of that would be helpful? PositionHandle2D looks promising...
  2. bigd

    Runtime Level Editor Thread

    @IAmMoore08 Ah, okay, makes sense. Basically any movement of geometry can be done just as easily within code as it would be if you had a realtime gizmo, you would just need to trigger it somehow so it can feed in the Vector3 scale information, if that makes sense. I'm not privy to any method that does this for you automatically. I tried looking myself and ended up just doing it manually using the procedure I mentioned above.
  3. bigd

    Runtime Level Editor Thread

    @IAmMoore08 Hey there. While I haven't done multi-face scaling, I have been able to do single face scaling. Here's what I believe the basics would be, you'll have to figure out the specifics because it'll depend on how your real-time transform gizmo works so you can integrate with it. Placing your transform in the center of all selected faces 1) Get the average of all selected faces. This nifty function should be able to help with that. I would think for each face, you should have one Vector3 that's it's average. private Vector3 FaceCenter(pb_Object pb, pb_Face face) 2) Get the average of all your face averages, place your scaling transform there. Scaling selected faces 3) Now that your transform in placed, you'd need to detect how much the user is looking to scale by and by which axis. (I used a Vector3 and save the axis in the direction and the scale amount in the magnitude) 4) Iterate through all the distinct vertrices of your selected faces and scale based on the scale amount. Set the vertrices of the mesh afterwards. 5) ??? 6) Profit. That's pretty much the basics. It's not easy, although @karl might have a cleaner way of doing this. Hope this helps!
  4. bigd

    Runtime Level Editor Thread

    @karl Question for you sir, when you have a minute. Trying to figure out how to do snap faces to the nearest x,y,or z whole number depending on which axis you are pulling and having a little trouble. See video below. Ideally, after freeforming, I'd like the face to snap the face to the nearest whole number. Right now, it just increases the size by one, regardless of the starting value. Here's what I have so far in terms of code. private void MoveFaces(float distance, Vector3 axis) { Vector3[] verts = currentSelection.pb.VerticesInWorldSpace(currentSelection.face.indices); for (int i = 0; i < verts.Length; i++) { if (selectedAxis == Axis.X) verts[i].x = Mathf.Round(verts[i].x * distance); if (selectedAxis == Axis.Y) verts[i].y = Mathf.Round(verts[i].y * distance); if (selectedAxis == Axis.Y) verts[i].z = Mathf.Round(verts[i].z * distance); Debug.Log(verts[i].x + " " + verts[i].y + " " + verts[i].z + selectedAxis.ToString()); } currentSelection.pb.TranslateVertices(currentSelection.face.distinctIndices, axis.normalized * distance); } I think the problem is that I'm not setting the vertices of the mesh after I move them in the for-loop, any suggestions? Thanks.
  5. bigd

    Runtime Level Editor Thread

    @Nyrow Face extrusion and translation, wireframe, adding material to a face, and flipping object normals are currently implemented. I'm currently trying to figure out face scaling, edge selection/translation, whole object translation/rotation/scaling/copy/pasting, and object serialization. After that, I'm not sure I'll go much further, even thought that's just scratching the surface of what Probuilder can do. In terms of when, I think I'm still a few weeks away from getting something ready to publish. My code right now is full of comments, debug statements, and wouldn't be too helpful to anyone in it's current state. Seems like there quite a few people like yourself interested in this, kind of makes me think I might need to set up a donation fund so I can purchase an actual license.
  6. bigd

    Runtime Level Editor Thread

    @karl Still plugging away, making great progress actually, but a long way to go. Your other posts on this forum have been pretty helpful. I was curious how you tackled face rotation and scaling. I'm guessing your functions for this are tied pretty close with the editor rotation and scale handles, but was wondering if there were any functions that rotated the vertices nicely around a point?
  7. bigd

    Runtime Level Editor Thread

    @Hertzole Yeah - it's sort of hard for my to advise without seeing exactly what your script is doing. It should be as easy as just traslating the vertrices of the selected face in the X/Y/orZ direction by some amount. I say "easy" but really, it's not. The math is sometimes very difficult to visualize through the code to understand exactly what's going on. Your logic seems sound, my advice would be to use some debug statements to see what's going on to cause it act so violently. @karl Question for you sir. After going crosseyed trying to make sense of how to grab the edges, I seem to be able to draw the lines of the edges but it destroys the original mesh. Looking through the blog, it looks like you actually have two meshes showing at the same time, one that has the faces, and another (hidden) one that shows the modified wireframe. Am I understanding that correctly? That sort of blows my mind a bit, but it makes sense. Looking forward, is it the case where all object manipulation (vertexes, edges) are selected and manipulated using the wireframe model and then sent to the mesh model (with the faces)? I'm beginning to think I should have jumped at the chance to buy probuilder when it was on sale so I can see exactly how you're doing this, instead of reinventing the wheel.
  8. bigd

    Runtime Level Editor Thread

    Hey there! Yup, you got it, TranslateVertices() all the way. The difference between what I did and what's already included in the runtime example is that I use a variable instead of the float (1f and -1f) that's in there currently. Like so: currentSelection.pb.TranslateVertices(currentSelection.face.distinctIndices, localNormal.normalized * distance); To calculate that distance variable, I calculate the magnitude of the vector3 on the axis that the player moves. Like so: distance = ExtVector3.MagnitudeInDirection(mousePosition - previousMousePosition, projectedAxis) * moveSpeedMultiplier; Once I get things somewhat working overall, I'll be happy to post what I have for you to mentally digest. I have a few other functions I'd like to get working (and tons of cleanup). Hope this helps!
  9. bigd

    Two quick questions

    Not sure if this helps, but I noticed under Mesh Renderer > Cast Shadows, it's automatically set to Two-Sided. Switching it to On will result in regular lighting.
  10. bigd

    Runtime Level Editor Thread

    Great! I was curious what the distinct vertices did, so this helps clears up that for me. I'll munch on this for a bit.
  11. bigd

    Runtime Level Editor Thread

    Good stuff! I'll crawl through this, thanks! I'm pretty much just using the example Runtime API code, so: FaceCheck(Vector3 pos) and RefreshSelectedFacePreview() to generate the selected face highlight. I don't actually use these functions when I flip the normals on the faces, they're just called whenever I click the mouse on a face, if that makes sense. Any idea why they would only create the highlight for one triangle instead of the entire face after flipping the normals? Playing with this more, I think I asked the wrong question. It looks like when I use the editor version, there's a bounding box that is present around all the faces. See pic below, this doesn't show up when using probuilder at runtime, any idea how this is enabled? http://imgur.com/H5Fh4UW Thanks,
  12. bigd

    Runtime Level Editor Thread

    Hi Karl - Trying to not take up too much of your time answering small questions so I appreciate you being my training-wheels until I get the hang of the code-base a little more. If I get things working right, I'm considering making my runtime code public (with your guys' permission of course) to hopefully give other peeps more functionality than what currently exists in the example. Played around with flipping the object normals today and noticed something strange, see below. For the most part, I'm using: pbTriangleOps.ReverseWindingOrder(currentSelection.pb, currentSelection.pb.faces); currentSelection.pb.ToMesh(); currentSelection.pb.Refresh(); Any idea why I'm getting a triangle selection (instead of face selection) after I flipped the normals? Also, I'm noticing on some videos online, there is a transparent texture applied to the walls that have the normals facing away from the camera. (see below). How is this done?
  13. bigd

    Runtime Level Editor Thread

    Managed to get some time to work this today. So far, so good. I think I'll tackle extrude or switching the object normals next, will let you know if I have any questions but open to hints/suggestions :-)
  14. Hi all, Just downloaded the free version of probuilder and was looking to use the in-game realtime probuilder api for a level editor I'm making for my project. I've taken a look at the runtime example included with the project and was happy there was a start provided, but there's much to be desired to make this usable. Before diving in, I wanted to check the forums to see if someone had tackled expanding this functionality yet and willing to share? Also, I noticed there isn't a public code documentation available, anyway to get view-only access to the code base? Thank you!
  15. You da man. Thanks Karl.
  16. Awesome! Looking forward to it. Thank you!
  17. Alternatively, a doxygen stub list would work for me as well.
  18. Hi Karl, Thanks for the response! From what I'm seeing, downloading the source via user toolbox is limited to advanced users only. Anyway I can get view access as a free user?
×