Hello! I am using a list to get all objects in the scene that have “Grass” in their properties, to make a grass (not procedural, because I don’t know: (…). But when I apply “localOrientation” to each object on the list, they change their orientations in the same direction, and their orientations are different.The objects have an “arrow” on top because I was wondering if they changed for each other in different ways (and it worked …).
(Note: UPBGE Project)
Edit: The bad script…
import bge import math import mathutils import random from collections import OrderedDict class grass(bge.types.KX_PythonComponent): args = OrderedDict([ ("velocity", 0.0), ]) def start(self, args): self.velocity = args["velocity"] self.x_z = 0.0 self.y_z = 0.0 self.timer = 0.0 self.grass = [obj for obj in bge.logic.getCurrentScene().objects if "Grass" in obj.getPropertyNames()] self.tree = [obj for obj in bge.logic.getCurrentScene().objects if "Tree" in obj.getPropertyNames()] for gr in self.grass: gr.setParent(bge.logic.getCurrentScene().objects['Ground']) gr['Ori'] = random.uniform(0.0, 360.0) xyz = gr.localOrientation.to_euler() xyz = math.radians(gr['Ori']) gr.localOrientation = xyz.to_matrix() def grass_logic(self): def ori(): self.x_z = math.sin((self.object['Time']*self.velocity)/1.2)/5 self.y_z = math.cos((self.object['Time']*self.velocity)/2.3)/5 return(self.y_z, self.x_z) for gr in self.grass: gr.worldOrientation = ori() gr.worldOrientation = ori() for tr in self.tree: pass def update(self): self.grass_logic()