How to load a model as a geometry

is there a way to make a geometry object by loading a j3o file
i mean when i load a .j3o file an Exception comes so need the object(j30 model) to be a geometry
thanks in advance!

Yes, you have to do differently.

(Note: better answers will be provided for better questions. Like, don’t mention an exception without details like a stack trace.)

Please please please please please read: mikeash.com: Getting Answers
…before posting again.

can u elaborate plz

Only if you do.

ok then please tel me how to load a .j3o model as a geometry

You need to learn to read better. I asked for something.

I’ll repeat it here. Don’t bother posting about an exception without including a stack trace. When you do, it makes other forum readers want to commit bodily harm on your person.

Bottom line: EXCEPTIONS ARE COMPLETELY 10000000000000000% USELESS WITHOUT A STACK TRACE.

Basically, you walked in here and said “I have a problem, can someone help me.” and provided little other info.
You: “Hey, car mechanic… tell me how to fix my car.”
Mechanic: “Can I actually see the car or hear about the problem.”
You: “…”

1 Like

Anyway, let’s play the game as written…

Yes, create a j3o file with only a geometry in it.

…or find the literally hundreds of other threads talking about scene graph structure and how sometimes a j3o contains lots of geometry in a hierarchy of nodes. Learn what the scene explorer is and how to look at your j3o and see the hierarchy. Do some tutorials.

…or move on to a game development tool that supports more drag-and-drop coding like Unity.

java.lang.ClassCastException: com.jme3.scene.Node cannot be cast to com.jme3.scene.Geometry

this is the exception

@playlikeme_99

Check this thread, it contains some walk-through and investigation for case similar to yours.

EDIT: also note we are here talking about java code, at least without a code and detailed exception noone could help you, unless one of the expert core developer who can catch it by little details, so increase your chances to get your issue solved by giving us more elaboration

The problem is you are loading a model that contains a parent node.

Try opening up the .j3o in the scene composer or iterating through all the children to find the geometry.

Once the geometry is found you can do myModel.getChild(whatever geometry child); and cast it to Geomery