I have a 3D scene with a 2D sprite based character (set for 3D).
I have a tree sprite and on the floor is an apple sprite.
I want the player to be able to click and lift the apple and place it on the tree (not on a Track). I have setup two apples, one as a Moveable Drag and the other as a moveable pickup for testing. I'm not sure which is ideal for my case yet.
I also have a trigger on the tree brunch with “Object to Detect” and an invisible apple on the end position which becomes visible when the trigger gets activated, at the same time the draggable one becomes deactivated with a “Send Message OFF”.
All is good so far and work fine.
1)
What I want:
Question:
The moveable pick up has an “interaction on grab”. I use in there a Player constrain to disable movement and it works fine. But can’t find a way to Enable movement again when he let go of the apple on the floor.
Is there an ”Interaction on Let go”? when player release the left mouse click...
How can i achieve this?
I see in the action lists that there is a “Moveable” -> Check held by player. That is great, I tried it.
But I want an action for when he let go and the object drops back on the floor.
2)
Both apples use an “interactive Boundary” so the player can lift them only while inside the boundary.
For that reason i need some kind of collision wall around the Boundary so player can't drop or move the apples outside of that area.
Best way I thought of solving this is by using a collision tube around the tree area with inward faces, and i deleted the outer faces.
a)
Is it possible to set up a Collision wall which will not affect the player but affects only the apple sprites?
b)
If a) is not possible, I could teleport the collision wall in place only when the player has lifted the apple and can’t walk because his movement is disabled.
But I then need an action to teleport the collision wall outside out of the level for when he let go of the apple back on the floor and player can walk again without colliding on apple wall collision.
But can’t find a way of doing that?
Any help will be much appreciated.
Thank you
Check screenshots of the two Moveables
https://imge.to/i/vqVPR4
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
There is currently no "Interaction on let go" field, but I agree that there should be - and I'll look to add one in the next release.
In the meantime, it is possible to hook into the OnDropMoveable custom event and have it run an ActionList. Attach the following to the PickUp as a script named "ActionListOnDropPickUp":
It is possible to have colliders ignore/react to objects given their layer by editing Unity's Physics settings - or by calling Physics.IgnoreCollision through script. This is not AC-related, however, using the above script you can teleport the collider out of the way upon letting go.
Hello Chris, thank you very much for your help.
The script works great and also the collision issue is solved.
A small issue that occurs now is that when i pick up the object and drag it in front of the player the camera snaps/zooms on the player for a sec and the object drops.
I attached a screenshot with player settings and a video showing the problem:
The apple pick-able settings are in my previous comment.
Any idea?
Video
https://imgur.com/D42ubaZ
Screenshot
https://imge.to/i/vq28bW
Thanks again
That the InGame menu (the "Menu" button in the lower-left corner) disappears at the same time suggests that some kind of gameplay-blocking cutscene is running.
Enable the AC Status box via the bottom of the Settings Manager. What does it show at the moment this occurs? It should also tell you of the active camera - is this being changed inadvertently, and what type?
I had on my camera settings the "Detect wall collisions" ON... that is the reason for the camera snap/zoom issue :-)
I noticed the moveable Pick up (right apple), when it hits the collision box it drops on the ground and the InGame menu flicker.
but
the moveable Drag (left apple) stays against the box and their is no flicker.
Is there a reason for that?
I'm asking because i plan to have few moveables around and need to be sure if something is wrong with this.
Video:
https://imgur.com/8aTkpPl
Thanks
The default InGame menu's Appear type is set to During Gameplay - so it'll turn off whenever gameplay is blocked, even if it's only for a frame.
Flickering like this can occur if an ActionList is run that - although brief - blocks gameplay.
You can prevent an ActionList from blocking gameplay by viewing its Inspector and setting its When running field to Run In Background.
Ok i understand what you mean and i'll use that thank you.
But i didn't make clear that i need please an answer for the other thing i mentioned about the Moveables.
The two different types of moveables (drag & pickup) behave differently when they touch a collision wall while i hold and drag them.
Are they supposed to behave differently or am i missing something?
Also i noticed about the PickUp object, that the player can walk through it while it's on the ground. No collision there.
But the Drag object i can kick it around when player walks through it.
Is this normal?
Check the last video please.
Sorry, these are the last questions about this subject.
You have done a great job with AC, i love it. Congratulations.
Yes, they're intended to behave differently, as they suit different purposes. The PickUp is intended for an object that can move freely around a scene, whereas the Drag object set to "Move Along Plane" is constrained to 2D movement and intended to move only within a controlled space.
The connection between the cursor and the PickUp will "break" if the force applied to it is too great - i.e. if the distance between them is too large due to the PickUp getting caught on a collider. You can raise the break force threshold, however, by increasing its Break force Inspector value.
What behaviour are you looking to achieve? Both types have an Ignore Player's collider? in their Inspectors - what is this set to on both?
Before, i was setting the Break force to 10, 80, 150 and couldn't see any difference.
Now i increased the Break force to 1000 and it did the trick... Yes
Both Drag & PickUp objects have the Ignore Player's collider checked.
Player ignores the Pick up object and can pass through it. That is correct.
But Player is colliding with the Drag object and push it aside as he walks... even though both objects are setup exactly the same, the player is colliding with one and not with the other.
Anyway Chris, it doesn't matter. I got what i wanted now.
Thank you very much for your help, really appreciate it, i learned a lot from this Post.