I'm working on a procedural terrain generator using Geometry Nodes and I want to include the option of having buildings or other objects placed inside a collection that the terrain uses as a reference for where not to put grass, pebbles and rocks. The issue I have is that I've been only able to do it with the faces of the objects in the collection, and when they are big enough, that causes the points to be distributed inside the object. Here's a capture:
I've scoured the internet for help, but since the change in the geometry nodes on 3.0, most of the answers I can find use the old system and I can't find a way to adapt it, so I'm asking for help here, because I ran out of ideas. Here's the current set up I have to make the selection to know where not to put points for the grass:
I did try using the Mesh Boolean approach, but it is too resource heavy. For the buildings is not a problem, but when I use it for avoiding grass from spawning inside the big rocks, it makes the entire geometry nodes really heave resources wise.
Any Help is appreciated, I've been fighting this "bug" for three days now and it's driving me crazy. Thanks!
After many searches, I've managed to find a solution that works! It is using the method explained in this tutorial: https://www.youtube.com/watch?v=tvb2aCeTANM
Basically, you create a raycast on top of the scene and use a Boolean Math node to detect if it's hitting or not. In my case, for deleting the Geometry in the mesh where the points are distributed, I used a "Or" operation. You can see the node setup here: New Node Setup
Hope this helps anyone else having the same problem :). Of course if anyone can think of a better solution, feel free to add it!
Just use Raycast node with position node to evaluate a dot product
and then add map range with clamp checkbox
Related
I'm writing a paper comparing D*, D* Lite and LPA* and how useful they are in navigating an agent across a dynamic environment.
If anyone has any info that would be helpful for this please leave below.
Specifically, can anyone explain in simple terms why D* and D* lite traverse from goal to start rather than start to goal like LPA*? I understand the g value would then be the distance from the goal but confused as to what benefits this has.
Thanks in advance.
When you search outwards from the start state, all of the outward paths also give you routes back to the start, making it easy to get back there. Then, when you get to the goal, you have one path to the goal, but many paths from other states back to the start.
If the world isn't changing it doesn't matter whether you search backwards or forwards (or bidirectionally), in the end you have a path that you can use.
But, if the world changes and you lose your one path to the goal from a forward search, it can be hard to re-connect to that single path. If instead you search outwards from the goal, you still have many paths back to the goal. If the world changes, you can then search to reconnect the invalidated states back to any path that leads to the goal (of which there are many). Although it may not be optimal, it may only require a small and simple repair.
I am creating a 3-D game with a cave as the main environment. The cave is made of a large number of ring segments, one attached to the other, thus creating a currently small tunnel system.
If the Player is inside the cave, only a small part of the segments are visible. I am figuring that actually hiding the not-visible segments could save a lot of gpu time, which I need for other objects like buildings or enemies.
So what I try to do first is hiding the entire cave and then unhiding the visible segments by turning ‚node.isHidden’ true and false.
The particular nodes are being found and accessed by their names: ‚Node.childnode (withName: „XYZ003“, recursively: false).isHidden = true‘ (or false).
It works to the point where the segments are unhidden, but once I am trying to hide a previously unhidden segment, the renderer crashes with an EXC_BAD_ACCESS.
Doing the hiding on a hidden object (of course useless, but helping to understand the problem) is fine, so is unhiding unhidden segments.
Following the hint of another thread, I moved the routine into the renderer delegate so not doing the switching during the wrong time, but instead during the phase in which such changes are supposed to happen, but this did not help.
As an alternative, I did the hiding (and unhiding) by SCNActions, but I received the same result, which really puzzles me, as this would be kind of the ‚official way‘ to do it...
I also played around with the ‚recursively’ boolean, getting the same outcome (works for unhide, crashes on isHidden = true).
Then I tried to change opacity or other properties of the nodes - which worked perfectly. On the other hand, trying to remove the nodes from the parent resulted in the mentioned crash as well.
I need this to work, because older hardware could never cope with several thousand nodes (trying this, the frame rate dropped to 10fps, even without enemies around). And newer hardware might break down once the enemies appear...
My thinking is that the pointer is somehow messed up by the first unhiding (and hence the BAD_ACCESS error), so maybe an additional bonding (often seen with spritekit-routines) or another way to get the node-pointer could be the solution. On the other hand, if the pointer is broken, why can I still access all other properties? Maybe it‘s the subnodes that cause the problem - everyone of the nodes has 20 subnodes, which are supposed to change visibility, too.
Did anyone come across this behavior before me? I could not find anything during my google-research...
Hiding and unhiding nodes frequently is typically not a problem by itself. You can hide a main node and any sub-nodes of the main node will automatically hide themselves, so you shouldn't have to loop them individually.
I'm not an expert debugger and don't know your skill level, but BAD_ACCESS can mean that you tried to send a msg to a block of memory that can't execute the message or whenever the app tried to deference a corrupt pointer. Search "What Is EXC_BAD_ACCESS and How to Debug It" for a decent tutorial on some options for dealing with it.
I do my changes in the render delegate as well, but depending on the number of changes and how long they take, I sometimes use timers to control the amount of changes that can be made in a certain amount of time. That way, and after some adjustments, I'm pretty sure that I'm not bogging it down to a point where it just spirals out of control.
Structure can matter - personal preference, but I try to setup an array of classes that create individual nodes (and sub-nodes) and therefore have direct access to them. That way I'm not iterating through the whole node structure or finding nodes by name. Sometimes a lot is going on before I really have to make a modification to the node itself and so I can loop through my array of classes, check values, compare, etc. before taking action that involves the display. That also gives me a chance to remove particle systems, remove actions, set geometry = nil and update logic counters when I need to remove a node.
I'm sure opinions vary, but this has worked well for me. Once I standardized the structure, I just keep repeating the pattern.
Hope that helps
I am currently working with GraphDB to visualize some data that has a graph nature. I have imported the RDF data into graphDB and actually the graph is pretty nice. The only downside is that every single node is orange.
I was wondering then, if graphDB has some mechanism whereby the color of some nodes could be changed based upon a semantic relationship between them. For example:
<Berners_Lee> <created> <web> .
<Berners_Lee> <works_as_a> <teacher>
If I were to load this onto graphDB all nodes would appear by default in orange. Is there any way I can specify that nodes that are pointed by relationship created appear in blue?
I hope everything is clear. Any help would be much appreciated.
The colors are generated automatically and differentiate the types in one graph, which is their main purpose. Also we do not handle properly the case with multiple types for a node, but we have it in mind. The problem with your data is that all of the subject predicates and objects have no type (which makes them the same type). Here is a small example, based on your data which will produce the desired effect.
<Berners_Lee><created><www>;
<works_as_a><teacher>;
a <Person>.
<teacher> a <Occupation>.
I currently have two nodes in use, one of which is a boat (polygon) and the other a straight vertical rectangle. The boat needs to be a polygon so that it can be hit via projectiles, however this causes me problems when it collides with the vertical rectangle due to the many sides it's coming into contact with. Hence a piece of code I want ran only once is instead ran multiple times.
Is there anyway to make the collision detection only function for the first contact so that it doesn't repeatedly call?
I'm aware of setting the categoryBitMask to 0 however doing so renders the boat unable to be hit by anything else- something I don't want. Additionally I considered using a boolean variable to only run the code once whilst the boat is passing through, however as previously mentioned, due to the different sides, the code think it's passed through when in fact it's just hitting another side of the boat.
I don't have much code to show here other than setting physics bodies so I don't think it's necessary, but inside didBeginContact() I'm using a categoryBitMask comparison to check for collisions.
I may have not explained this very well, in which case I apologize, my English is not the best!
If anyone can help, it'd be much appreciated, thanks.
You can combine the individual physics bodies of your ship into a single body with
+ (SKPhysicsBody *)bodyWithBodies:(NSArray *)bodies
and then test for contacts with the composite body instead of the individual components.
If you are subclassing your node then simply create a BOOL property for it.
BOOL alreadyHit;
If you are not subclassing, use the SKNode's userData dictionary and create an entry for the same.
I have a bunch of nodes on each side of a central node. I am trying to find a way to position the node lines so that they go to the right or left side of the nodes.
So for this:
http://jsbin.com/ipuxub/4/edit?js,output
I want the lines for the Jerry node to go to right side of Elaine, George, Kramer, etc.
While I don't think this is possible now:
Is there a way to force it, trick it or make it look better?
If it is changing the Cytoscape JS code, any suggestions to where I begin or look at or what would need to be changed?
Controlling edge control points more manually or adding support for node bend points are things we have planned to add in future, and I think either case would satisfy your use case.
However, we do not have the resources to do this in the short term: Both cases require our side to plan how those features would fit in with the model and visual style system (cy.js css).
In the short term, if you want to control where edges are drawn, you have to adjust the positions of the connected nodes -- because the edge positions are inferred between them. The first edge is straight between them, and for 2 or more beziers are used.
If moving node positions does not suffice for your usecase, the first steps would be for us to discuss and plan how this feature would work and how it would fit into the system: https://github.com/cytoscape/cytoscape.js/issues/359
Then if you're interested in implementing it, it would be a straightforward process. We could direct you to the relevant parts of the code that would need to be changed etc over a Google+ call.
Thanks -M