Does anyone know if you can make a ray sensor search for more than just one property or material? I am trying to set up a camera/character system like in resident evil 2 remake. Any help would be appreciated!
Have multiple ray sensors searching for each property connected to a single “OR” controller
Better use python for it.
Example if needed
def raycast(cont): own = cont.owner start_vec = own end_vec = own.worldPosition + own.worldOrientation.col # y direction distance = 10 objects_to_look_for = ['object1', 'object2', 'object3'] #object names to look for ray = own.rayCast(end_vec, start_vec, distance) if ray: #ray hit something hit_obj = ray if hit_obj.name in objects_to_look_for: print('ray hit:', hit_obj) if hit_obj.name == 'object1': #do something with object1 here elif hit_obj.name == 'object2': #do something with object2 here elif hit_obj.name == 'object3': #do something with object3 here
How did you learn all of this? I really want to learn python but I keep putting it off. Do you have any suggestions for a tutorial series? And is the main python the same as the bge scripting?
self thought trough youtube, google and a question on this forum once a while.
Just start somewhere i would say. In this case you need raycasting so a simple search as ‘blender game engine ray cast python’, will uncover a lot of details that you then can read and try out.
On youtube, search for ‘blender game engine python tutorials’ or something and follow those.
Python is not hard to learn, however it’s hard to master it, but for bge you don’t need to master it, the basics are just fine. Not every line you write with python is the same in python or in blender, because in blender you need to call objects etc, from within (just like any other program you would use to program python), but yeah python is python. learn python in bge and you get the basics to use python for anything you like really.
YouTube sadly doesn’t have many BGE Python tutorials
- Here has some great BGE Python tutorials, but the creator isn’t active anymore sadly.
- Some more good tutorials. There all in German sadly (Use YouTube translation subtitles)
- YouTube Arsenal RSL had really great simple tutorials, but he removed all but 2 of his videos sadly for some reason (I think YouTube banned his account or something)