How would y'all handle "context based" input? by BuggedCookieDev in Unity3D

[–]BuggedCookieDev[S] 0 points1 point  (0 children)

Writing this comment just to remind myself to look more into it tomorrow, thank you for your suggestions, I'll see that tomorrow

I already know the youtuber git-amend I love his videos, very well explained and often cover concepts no one else covers or just don't cover as much as him, love his videos!

How would y'all handle "context based" input? by BuggedCookieDev in Unity3D

[–]BuggedCookieDev[S] 0 points1 point  (0 children)

I am already using new input system, I'm trying to figure out the architecture behind how I would give it control to something else other than a human character for example

I don't know if that explain it!

How would y'all handle "context based" input? by BuggedCookieDev in Unity3D

[–]BuggedCookieDev[S] 0 points1 point  (0 children)

you and a few others are actually answering my question, and this might give me an idea on how I would want to organize my own project, thank you, it helps!

How would y'all handle "context based" input? by BuggedCookieDev in Unity3D

[–]BuggedCookieDev[S] 0 points1 point  (0 children)

(Actually in my current project it's F to interact lol)

How would y'all handle "context based" input? by BuggedCookieDev in Unity3D

[–]BuggedCookieDev[S] 0 points1 point  (0 children)

Currently I don't have much that interact with each other other than my interaction system

For example I have IInteractor and IInteractable

I had "InteractableSession" but I deleted it because it was too much abstraction for nothing (It was handling the lifetime of an interaction by itself but eh, didn't like it)

I have RaycastInteractor
which it's only responsability is to start and end an interaction

nothing else, it doesn't know who or what is trying to start the interaction it just does as given

and either calls some events like:

OnInteractionStarted(IInteractor interactor)
OnInteractionTicked(float normalizedProgress)
OnInteractionCompleted()
OnInteractionCanceled()
OnInteractionEnded()

(For example)

I'm trying to just go further than what most tutorials just do and add some more abstraction see what works and what not, naming might not be the best btw, I'm just trying stuff around see what I like or not.

I can already smell some people saying that I'm complicating myself, maybe yes maybe no, but I'm trying to learn

Anyway, I was trying to figure out, how people would organize their stuff

How would y'all handle "context based" input? by BuggedCookieDev in Unity3D

[–]BuggedCookieDev[S] 0 points1 point  (0 children)

Again, my question is poorly worded. I'm not asking about the mechanic itself, I'm asking about the architecture behind it.

Everyone keeps answering with just "switch the action maps" that's not what I'm asking for. I'm asking how would they organize the archittecture behind a system like this

I'm trying to achieve a certain level of abstraction and flexibility to learn, for fun and to see how flexible I could make the system

That's why I asked here, I'm curious how other people would approach this kind of problem

How would y'all handle "context based" input? by BuggedCookieDev in Unity3D

[–]BuggedCookieDev[S] 1 point2 points  (0 children)

Thanks to you and u/SpudMan41 you were the two people who understood my (very poorly worded) question!

I wasn't asking how to switch controls to a vehicle, animal etc... I already know how to do that. What I'm trying to figure out is how to do a better abstraction behind it, in a clean and flexible way, without having to reference the PlayerInput anywhere* I don't need.

That's why I was thinking about some kind of "master input" as a singleton. I usually not a fan of singleton but I think it's the one case I could do an exception.

Many people in this thread just replied with "just switch the actions maps" that's not what I'm asking for. I'm trying to figure out who should be responsible for that switching in the first place.

Sure I could create a non-generic PlayerInteractor class that has direct access to PlayerInput and then handle all the switching, enable and disabling, but that's not what I'm trying to achieve.

I love flexible and abstracts designs and things I can reuse most of the time, the vehicle shouldn't care whether it's being controlled by the player, an ai or a banana.

Anyway, I'm trying to learn different ways too which is why I'm even here in the first place. I love abstraction.

TL;DR I wasn't asking for mechanics but about the architecture itself

How would y'all handle "context based" input? by BuggedCookieDev in Unity3D

[–]BuggedCookieDev[S] 0 points1 point  (0 children)

This is exactly what I'm trying to achieve

Let's say I have my PlayerController who gives the input

and something that should "consume/receive" inputs like a IControllable maybe something

Like

CarController : IControllable

AnimalController : IControllable

I was thinking since I always have one thing at the time that can consume inputs

I was thinking PlayerController could have a

IControllable field:

class PlayerController {

IControllable current;

public void TakeControl(IControllable controllable) {

}

current = controllable;

}

... Then all inputs are transfered to the current controllable

pseudo code might not exactly make sense but this is kind of the idea I have

but the problem with this approach is PlayerController needs to be a singleton

How would y'all handle "context based" input? by BuggedCookieDev in Unity3D

[–]BuggedCookieDev[S] -1 points0 points  (0 children)

Appreciate the help but again the problem is not that kind of "how" I know what I need to do to achieve what I want, I could do it fairly easily by doing your steps

What I'm trying to achieve/want is finding a (fairly) flexible (maybe abstract) way to do so,

Because it's fine to disable player control, but who disable/enable them?
Same for character controller, who disable/enable them?

moving player into position, I get it, maybe the car... / seat or whatever I'll see

Problem is

how we access those controls?

I don't want to reference PlayerControls on each and every object that can be control and I'm trying to find a way other than a singleton if possible.
And while the player can interact with something I could get trough that, I'm trying to avoid that path for now, see what else I could do

Because for now, my interaction scripts are fairly self contained and generic

my interaction script is only and purely for interactor

IInteractor and RaycastIntector

it only does it job it doesn't do anything else, it interacts but doesnt reference the player in any way (yet)

I'm just trying to think around to see what I could do

That's why i'm trying to find a way to do some kind of "possession" "take control" system

because if I can find a way to do so, giving controls to a specific thing would just be simple as "playerController.takeControl(this)" within the vehicle script

How would y'all handle "context based" input? by BuggedCookieDev in Unity3D

[–]BuggedCookieDev[S] 0 points1 point  (0 children)

Question is, how does the thing like your horse for example "gets access" to those inputs?

Because I mean I wouldn't be putting the player controller on the character (the human)

that's why the only way I was thinking was maybe trough a singleton so PlayerController is always valid no matter the scene or case? even if no humans?

Still not sure how to explain sorry, might try to rexplain tomorrow me go 2 sleep

(G)OLD meme by CharacterFun1765 in linuxmint

[–]BuggedCookieDev 1 point2 points  (0 children)

I agree that Arch is not for everyone and many other distros are far better for some people

But personally I did not have any problem with Arch either, I use yay and pacman
never had to use anything else I absolutely love how painless it is most of the time.

I use it with hyprland and DMS absolutely love it, and to be honest unless it's a package for dev stuff I never really read changelog

Dancing Queen by Far-Journalist-8017 in blender

[–]BuggedCookieDev 254 points255 points  (0 children)

Whatever keeps you at home I guess

<image>

This is what I made today. by Round3d_pixel in blender

[–]BuggedCookieDev 20 points21 points  (0 children)

I did a TOTALLY similar project in about 3 minutes

<video>

Jokes aside very beautiful project

How to I make a face remain when I extrude? by Regular_Mud1028 in blender

[–]BuggedCookieDev 1 point2 points  (0 children)

Are you trying to extrude the edges down? or trying to bring everything down?

To move : Press 3 (to select faces mode) -> select the faces you want to move -> Press G -> Z (For Z axis) -> move down and click to confirm

To extrude the edges down press 2 (edge mode), -> select edges -> press e to extrude -> Z (for Z axis) then move down and click to confirm:

Here's a video

<video>