Player Input functionality ( this script is directly attached to the player itself) `hud.disp_item(curr_item, curr_item_slot)` `curr_item.look_at_from_position(self.global_position, self.global_rotation, self.global_rotation, true)` `curr_item.get_parent().remove_child(curr_item)` If curr_item = null: `curr_item = held_obj` #no current item is held in this inventory slot, we proceed to pick it up The pickup function ( self in this context refers to the player_hand Node3D position) I'm primarily focused on the programming aspect of this project and would appreciate the ability for the game designer/artist to be able to change this as they please without having to interact with the code as they're much less familiar with programming. I've also tried the look_at_from_position() function to translate the items position/rotation on pickup to for a more desirable result, but the documentation for this function leaves questions unanswered, what does the " bool use_model_front=false" refer to? How does this affect object translation? Is this a relevant use case for this function? Ideally I'd like a solution where we can adjust each items positioning in the players hand within the item's scene itself. I added an anchor position within the item's scene, and tried snapping this to the hand position, the same issue is present. I've attempted to solve this issue in multiple ways. For example, there's a flashlight item, sometimes when it's picked up it's facing backwards, other times it's directly to the right, and so on. This is all well and good, but when the item is moved to the players hand position its rotation/positioning is wonky. Currently when the player picks up an item, it's added to their inventory, the hud is updated as such, the item is set as a child of the player's "hand position" (just a Node3D that moves with the player), and the items global position is set to this hand position. The players inventory is a dictionary that stores references to the "currently held" item in each "item slot", this links up with a player hud to display a hot bar of items the player currently possesses. If a valid item to pickup is found, the game prompts users with a UI overlay. I currently have items setup as rigid bodies (with collision shapes, models, etc), and a ray cast projection coming from the players POV to detect them. Hello all! I'm currently working on my first 3D Godot project and am struggling to find a solution to my inventory system.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |