Obj file not loading correctly

I am trying to load in a traffic cone which was made on blender and was exported and an obj file. The traffic cone was loaded into the game, however the material used on the traffic cone was not loaded properly. It looks like this (for some reason):

Screen Shot 2021-05-27 at 12.05.41 PM

The traffic cone is supposed to be orange and white, however, not a rainbow color. Did I do something wrong?

TrafficCone class:

package ds.main;

import com.jme3.asset.AssetManager;
import com.jme3.bullet.BulletAppState;
import com.jme3.bullet.collision.shapes.CollisionShape;
import com.jme3.bullet.control.RigidBodyControl;
import com.jme3.bullet.util.CollisionShapeFactory;
import com.jme3.material.Material;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;

public class TrafficCone implements Obstacle {
    private Spatial mesh;
    private RigidBodyControl r;
    private final Material mat;
    private final Node rootNode;

    private final String file = "Models/Obstacles/TrafficCone.obj";
    private final float MASS = 0.01f;
    private final Vector3f GRAVITY = new Vector3f(0, -250f, 0);
    public TrafficCone(AssetManager assetManager, Node rootNode){
        this.rootNode = rootNode;
        mesh = assetManager.loadModel(file);
        mat = new Material(assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
        CollisionShape c = CollisionShapeFactory.createDynamicMeshShape(mesh);
        r = new RigidBodyControl(c, MASS);

    public void addToSpace(BulletAppState state){

    public void setPosition(Vector3f position) {

    public Vector3f getPosition() {
        return r.getPhysicsLocation();
    public void destroy(BulletAppState state){
        mesh = null;
        r = null;

This might be the problem. I’ve had trouble with obj before in regard to texturing. It is probably best to switch to j3o or another supported type.

1 Like

“ShowNormals” is specifically for debugging. For realistic rendering, you probably want a shaded material instead.