-
Notifications
You must be signed in to change notification settings - Fork 146
Open
Description
Hello,
I am new to the field of 3D modeling in android. I am trying to load an .obj file (in this case, it is a car) and try to rotate it 360 degrees. I have been successfully able to do that. Now, I am trying to change the color of the car using the code below to black color.
`public class ObjectRenderer extends RajawaliRenderer {
private DirectionalLight directionalLight;
private Object3D mObjectGroup;
private Animation3D mCameraAnim, mLightAnim;
public ObjectRenderer(Context context) {
super(context);
}
@Override
protected void initScene() {
getCurrentScene().setBackgroundColor(1.0f, 1.0f, 1.0f, 1.0f);
getCurrentCamera().setZ(16);
LoaderOBJ objParser = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.bmw);
try {
objParser.parse();
mObjectGroup = objParser.getParsedObject();
mObjectGroup.setScale(0.04f);
mObjectGroup.setPosition(0.0f, -1.5f, 5.0f);
//mObjectGroup.setColor(Color.BLACK) // I have tried this as well
Material simple = new Material();
simple.setColor(Color.BLACK); //I am setting the color here to black
mObjectGroup.setMaterial(simple);
getCurrentScene().addChild(mObjectGroup);
mCameraAnim = new RotateOnAxisAnimation(Vector3.Axis.Y, 360);
mCameraAnim.setDurationMilliseconds(8000);
mCameraAnim.setRepeatMode(Animation.RepeatMode.INFINITE);
mCameraAnim.setTransformable3D(mObjectGroup);
} catch (ParsingException e) {
e.printStackTrace();
}
getCurrentScene().registerAnimation(mCameraAnim);
mCameraAnim.play();
}
@Override
public void onOffsetsChanged(float xOffset, float yOffset, float xOffsetStep, float yOffsetStep, int xPixelOffset, int yPixelOffset) {
}
@Override
public void onTouchEvent(MotionEvent event) {
}
}`
The issue is I cannot see the color change on the object. This is what I see no matter what color I add.
Can please someone tell me if I am missing something.
Metadata
Metadata
Assignees
Labels
No labels
