atron Posted August 15, 2017 Share Posted August 15, 2017 Hi there,I'm trying to change the colour of a primitive once a particle collides with it….but i don't want to use an attribute transfer because that gives me a gradient of colour on the primitive and i want to change the colour back after it's been hit and have it be a solid colour. So hit == green (0,1,0)not hit == red(1,0,0)Another problem i'm having is when i don't use an attribute transfer and write it in a python sop(code below) i change all the primitives colours in one go rather than individually where the the particle collides with each primitive.Not sure how to go about this, but here is the file attached.Any help would be much appreciated.CODE FOR HIT COUNTER AND PRIMITIVE CHANGE COLOUR node = hou.pwd() geo = node.geometry() from hou.session import * inputs = node.inputs() # bring in city searcher data pointcolliders = inputs.geometry().points() ship = geo.prims() if hou.frame() == 1: hitCount = 0 for p in pointcolliders: store = p.attribValue(“hittotal”) # get hittotal attribute from the pop solver hitCount += store # hitcount += store (to add number of hits to hou.session) hits = store green = (0.0,1.0,0.0) red = (1.0,0.0,0.0) #change colour of second input so object for s in ship: if hits == 1: s.setAttribValue('Cd', green) else: s.setAttribValue('Cd', red) particles hit each prim.hipnc Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.