1. Hey! Guest! The 35th GMC Jam will take place between November 28th, 12:00 UTC - December 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

3D Can someone give me an example of a working inventory for 3D?

Discussion in 'Programming' started by RektByValve, Nov 9, 2019 at 1:43 PM.

  1. RektByValve

    RektByValve Member

    Joined:
    Oct 27, 2019
    Posts:
    12
    I tried many tutorials and even tried my own ways. Unfortunately none of them worked. If you have a working inventory that works in 3D please let me know!! I need it for my 3D survival game.
     
  2. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,693
    What exactly would an "inventory that works in 3D" be? What makes any other inventory not work in 3D - as in, what does it need to work in 3D? Inventory systems aren't inherently limited to be usable only in 2D or only in 3D, so I'm a bit lost regarding what exactly an "inventory for 3D" is supposed to be...
     
  3. RektByValve

    RektByValve Member

    Joined:
    Oct 27, 2019
    Posts:
    12
    Alright let me explain, what I mean by a 3D inventory is a inventory that would be the same as a 2D one but just with some lines of code changed so that iw would be compatible with 3D. If you still didn't understand what I mean here is that instead of drawing the inventory in 2D I want it so it draws in 3D and usable (by usable I mean so that you can move your mouse and stuff since when you have a 3D game the mouse locks to the center of the screen). Hope you know understand.
     
  4. TailBit

    TailBit Member

    Joined:
    Oct 16, 2019
    Posts:
    56
    It is pretty much the drawing parts that would be different, as you could still detect slot position with mouse position in view..

    "since when you have a 3D game the mouse locks to the center of the screen"
    Not all 3D games does this .. so here you need to disable your own codes that is the cause of this .. make it possible to switch between first person for exploring and mouse control for menu management.
     
  5. RektByValve

    RektByValve Member

    Joined:
    Oct 27, 2019
    Posts:
    12
    What I need rn is how do I make so that my cursor is not centered anymore when I enter for example the furnace. Hope you understand what I mean
     
  6. RektByValve

    RektByValve Member

    Joined:
    Oct 27, 2019
    Posts:
    12
    sooo any help? still cant figure it out
     
  7. FrostyCat

    FrostyCat Member

    Joined:
    Jun 26, 2016
    Posts:
    4,602
    Having 3D graphics doesn't automatically center your mouse. The reason it's centered in your particular project is because you copied off a 3D game tutorial with mouse panning, and it works by centering the mouse on every step and capturing only the difference in cursor position. This is why it's so important to completely understand tutorial code, and also why blind copying is useless.

    Look in your code for a function called window_mouse_set and the section of code responsible for mouse panning that comes after it. I'll denote this as /* Panning */. Now declare a global variable at the beginning of the game like this:
    Code:
    global.panning_enabled = true;
    
    And wrap the panning code with a condition like this:
    Code:
    if (global.panning_enabled) {
      /* Panning */
    }
    
    Then whenever you show the inventory or do anything that requires the mouse panning adjustments to be off, set global.panning_enabled to false. And when you need the panning back, set it back to true.

    This is a very basic technique that you should have mastered well before attempting anything 3D. I suggest that you halt all work on your "dream project" and get your basics in order first. Shirking off responsibility for every little part of your project to the World Wide Web is an unbecoming, disgraceful way to program.
     
    Catan likes this.
  8. RektByValve

    RektByValve Member

    Joined:
    Oct 27, 2019
    Posts:
    12
    THANKS!!!
    Recent Edit: Nope still dosent work...I get the same result whenever I enter the furnace my cursor is still locked to the center of the screen
     
    Last edited: Nov 10, 2019 at 1:12 PM

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice