I’m trying diferent way’s to do it, and I tried to search for tutorials but nothing. Please can anyway help me?
The 3D part is fairly new. I have little knowledge of the 3D part although it’s not that different but I think others will need more details before they can help you. What exactly do you want to do?
I want to make a raycast system so that the player can interact with an object. Like keys or something.
That’s above my knowledge. Does raycast have a 3D version yet? Or is that what you’re making? That extra z() in a 2D editor is a complete mystery to me.
Here are some links to algorithms to line intersecting a 3D box, though you’ll have to rework them into JavaScript or GDevelop events.
Otherwise you may have to wait until that functionality is provided by GDevelop.
That’s just the z position of the object, along the z-axis (the one going in and out of the screen), perpendicular to both the x and y axis. If you imagine 0 being the screen, then the positive values come out of the screen and negative values go into the screen.
I understand the z order. Maybe I didn’t use the right term. I find it tough to imagine setting up 3D objects in a 2D editor that you cant move a camera around in a realtime 3D editor. I know the 3D aspect is new to Gdevelop and they’re slowly adding features.
In 2D x,y can be left,/right and up/down. In overhead or top down the x,y are more like latitude longitude. I’m a little unclear of axis in 3D.
There’s anyone that have’s Discord?
What part isn’t working? Are you trying to delete just the wall in front of you? Or is it something else?
There are 3D templates. The next part of the 3D shooting gallery template is the raycast.
If you want to delete thet wall in front of you then you could use the raycast as presented. You would need to change target to your wall object or a group where the object is in. Then it would pick the object within range of the raycast.
If there are multiple objects in a group then you could check the objectName() of the object that the raycast selects and trigger a different action for each object. I don’t believe the object name has it’s own condition. You would have to use compare 2 strings and use groupName.ObjectName() for one expression and then the object name that you’re looking for on the other like “wall”
Raycast …
Subevents
---- group.ObjectName() is “wall” — delete wall
---- group.ObjectName() is “door” — open door
Etc…
As I said, im not experienced with the 3D aspect but this seems to be one way. Alternatively, you could use seperate raycast or one of the other project used collision with an object to select them.
I just wouldn’t know how to do the interaction sistem.
I just updated my last post. I believe this is one approach.
Ok, thank you. now works
I only have a last question… How could I make this text appear when the raycast is colliding with the “Target”.
When you invert the raycast it picks the farthest instead of the nearest test object. I believe if you add a NOT condition where you put the raycast condition thats currently inverted inside it and then toggle it’s invert status to not inverted then it should work.
You can probably avoid the last 2 raycasts if you use a Boolean variable with the other raycast and set it to true when it triggers.
Before the raycast add an event without any conditions something like set Boolean variable TargetSelected to false. Then add the action to set the variable to true as an action of the raycast.
Now, anytime the target object is detected the boolean will be true. You can then replace the other raycast condtions with a true and false boolean variable check of TargetSelected.
If true show text, if false hide text
You need to put the raycast in-between the variables actions and set it to false on each frame.
Set to false (without any conditions)
If raycast set to true
If true show
If false hide
And can yo do a screenshot of how to do it, it will be easier for me.
You’re so close. Remove the trigger once condition leaving the boolean = false then move the raycast event below it.