Is there a way to do this change the color of the dual-shock controller's light bar outside of unity through code? - unity3d

I am developing a unity game and I want to make the light bar on a connected Dualshock controller change color when a player has taken damage. Could someone please inform me of a way to do this, as unity no longer supports this.
I tried to achieve this by using the following namespace and then change the color of the light bar using a method, but soon realized that unity has deprecated this feature a long time ago.
using UnityEngine.InputSystem.DualShock;
Thanks in advance!
EDIT: Unity does in fact support this, just on their NEW input system package (which my team don't have the time to upgrade to). So I guess my new question is: Is there a way to do this change the color of the dual-shock controller's light bar outside of unity programmatically and through code?
Thanks!

Try this !
var gamepad = (DualShockGamepad)Gamepad.all[0];
gamepad.SetLightbarColor(Color.red);
from here : https://forum.unity.com/threads/dualshock-4-lightbar.848707/
Edit: Also, you have to be using the "new" input system : https://docs.unity3d.com/Packages/com.unity.inputsystem#1.0/manual/Installation.html

Related

Trying to find a way to create this minigame in Flutter

So I've been going crazy for a few days trying to create this exercise in Flutter.
Namely, it is 'pop the lock' type minigame like the old arcade game. The red shape would go around in circle and function would fire when you click if it is inside the yellow circle and game would stop. I've been thinking about how to do it in Flutter, but I still can't seem to manage to do it. There is this library:
https://pub.dev/packages/flutter_spinning_wheel
but I'm not sure how it would be useful. Anyone have any idea on how to do it, I don't really need the full code (though it would be useful), but just a general basic idea on how you'd do it. Thank you!
It seems something you can accomplish using percent_indicator package.
It has lots of properties for you to work around.

How to get manual camera focus in Flutter

Currently I'm using this library:
https://pub.dev/packages/camera and it has setFocusMode to either Auto or locked, but I need a way to be able to get manual focus mode for camera, where user can tap in camera feed and the focus should be adjusted accordingly.
How do I go about implementing this in my app?
I found this plugin https://pub.dev/documentation/manual_camera/latest/. Does this work? you could use focus distance. If you could get the distance of the object you could set it that way. It's almost like shooting out a ray in game programming. I don't know if this is possible to do but maybe using the size of the objects in the image you could get the distance. someone else has probably already figured this out.

How can I create a button using mrtk 2.4 and Unity 2019.4 (AR for Hololens) with a custom shape?

Hello.
I'm trying to create a button which is shaped in a custom, trapezoid-ish shape.
so far I've tried manipulating colliders on regular MRTK - toolbox buttons, and using
a 3d model as the button (like in Hand Tracking Example 1) with the scripts that the
documentation suggests (NearInteractionTouchable & PressableButton) so far with no success.
So, is there maybe a different way to create a custom shaped button for my Hololens UI?
thanks.
After my test, the guide How to make a button from scratch works fine for me. If you got that issue while using this document, did you adjust the Press Setting after adding the PressableButton component? The default distance data may be invalid, you need to reassign the distance values according to the actual size of your 3D model. If it still cannot work after trying it, please feel free to feedback.

How to detect color live using camera on android in unity

i want to make a live color detection using camera on android in unity. apps that i want is like "color grab" on playstore.
anyone can help me how it works? or how to make it on unity?
Well SO isn't a script providing service: always try to provide what you have tried already before asking a question. If you don't have any script, at least expose you way you want to do it, the steps you think are needed, ...
Anyway, I'd advise you to take a look at Unity Texture2D.ReadPixels() method:
display what you need on screen
when the user touch a place, call for ReadPixels()
then retrieve the color of the desire location on the texture using Texture2D.GetPixel()
If you want to search for a larger area (not a single pixel), you can look for all the pixels around the wanted location and then get the average color found.
Hope this helps,

Work with iphone camera

I am looking for anyone that can help create some source and a tutorial with me to answer how to create a transparent straight line on iphone camera.
Please , If anyone knows of a tutorial already then pls reply me.
If I understand you correctly, you want to have a live preview of the camera overlays by I more or less transparent line, right ?
Two solution come to my mind:
Build one view that gets the camera input via AvFoundation framework and build another - transparent - view that holds whatever elements you want to display on top of that.
Another solution would be to build one OpenGL view, use the camera input as texture for a background rectangle filling the whole screen and then render your other content on top of that.
If you are looking tutorial for camera overlay you can visit this. It has source code attached too. So you will find easy with that. But pls don't just copy paste try to understand the code when you have time.