Draw Gizmos Axis on Hololens - hololens

i use Hololens and when I move the object or rotate I should show the axes. The code to move or rotate the object I already have it and in the editor the gizmo asxis are seen, but on the hololens emulator no.
Can you help me? thank you so much

Your question is a bit unclear, but is it right to say you have a manipulatable hololens object working and you just want to show the X/Y/Z axes like the unity editor does?
The axis you see is just a gizmo to help show orientation while in the scene view. It will disappear in the Game view, or any emulator/actual build to a device. It's not an easy approach to try to make that axis itself appear in your finished game.
Instead, to show an axis, you just need to create your own 3D model of an axis, and attach it as a child to the gameobject you are moving/rotating.
You can enable or disable the axis gameobject if you want it to only appear while moving. Treat it just like any other Unity GameObject, the intro tutorials will show you how to do that.
Good Luck!

Related

Pygame Shooting Bullets

Recently ive been trying to create a small game using Pygame, Ive managed to display an image which can move side to side, the trouble ive been having is enabling it to fire bullets using the space bar.
Heres my code so far:
http://pastebin.com/24xDYwY7
Ive now got the bullet to display however it doesnt come out from the "turret.png", and just sits in the top left of the screen.
Is anyone able to help me with this? I am extremely new to python and would appreciate the help
It looks like you're using a technique I like employing in PyGame - using different sprite Groups for separating good guys, bad guys, bullets, blocks, etc… with a single unified 'all the things' Group.
What I don't see is the all_sprites.update() call that makes the whole thing work, though I do see player.update(). PyGame groups are designed to let you call group.update() in place of a for x in y call such as:
for sprite in my_sprites:
sprite.update()
EDIT: Not seeing your images in the right place? If they're being set to the upper-left corner, this is usually because nothing is setting the surface of the drawn image to appear where you want it to.
One thing I've found handy about PyGame's get_rect() call is that it allows you to pass arguments to set attributes of the rect you get back. For example, my sprite.draw(self) methods tend to look something like this:
def draw(self):
"""Sets the image's Rect to the middle of the sprite,
then blits to the screen.
"""
draw_rect = self.drawn_image.get_rect(center=self.rect.center)
SCREEN.blit(self.drawn_image, draw_rect)
This assumes that the sprite object's self.x and self.y are being updated correctly as well, but it's essentially the right thing to do; get the rect for the object you're drawing, set it to the right coordinates just as you do the actual sprite, then pass the image and the rect to SCREEN.blit().

android wipe animation when button bar slide up

I'm trying to create slidingup animation in android application to change between two view of layout.
I've tried from this tutorial
but the second screen didn't come like what I want.
I want the second layout to come like a wipe animation, like the following picture at the bottom
Refer this:
https://android.googlesource.com/platform/frameworks/base/+/ab51002847ea3dcdc0ba14eb330ab9ec292a9789/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
In the above code, focus on the animateCollapsePanels method
I was able to implement a similar transition by using a clipping Path. Because I didn't want my transition to rule out the use of Layouts in the clipped view, I implemented the clipping at the Layout level following this answer: Custom Layout that rounds the corners of its content
The clipping is no anti-aliased and you would need to do use instead PorterDuff and XferMode based solutions otherwise, but for a linear wipe animation like you're describing, clipping in the layout will achieve what you want. Basically you're doing a linear reveal whereas the accepted answer I linked does a circular clip.

How to drag a polygon in MFC?

I'm new to MFC. I know how to draw a line and how to scribble in MFC. I use CDC and some functions such as LineTo() and MoveTo() to do this. Moreover, I've got FillRect() and Rectangle().Now I want to drag my rectangle or any polygon in the view.It's like you drag a icon on your desktop.
I think the first step is to get the region.Then erase the old polygon and when the mouse move draw a same polygon which depends on the point where the mouse go.
So I search region in MSDN and I got Region class and CRgn class.But before I look into these two class I want to know whether I'm in the right direction.
I need more suggestions on how to learn MFC. Actually,all I need is to finish my homework which is mainly about draw polygons and drag them and link them by line. And I hope I can finish this homework all by myself and MSDN. Can MSDN help me do that?
The CDC::Polyline function will draw a polygon much faster than using LineTo and MoveTo.
You do not need region and do not need to erase the old polygon. Instead, you need to draw everything in the view OnDraw. Any change you want to make with the mouse should change the array of coordinates that represent the polygon and then call Invalidate. In other words, do not draw in the mouse message handlers. Calling Invalidate in the mouse message handlers will cause OnDraw to be called later and it should repaint the entire view.

In Android - how can I fill a view or drawing by a specific percantage?

How can I fill a bitmap in Android with a specific background, with only a percentage of it being covered, like below?
There would be a icon in the middle as well so the fill would have to be behind what is drawn. I tried using a gradient, but it wasn't fruitful.
Edit: Another image:
Assuming the Processing 67% is a textview and the green is the background that fills 67% of that Textview, how would you accomplish this in Android?
You can try using Arc here is the reference Arc Android Developers
and here is a great tutorial that might be of help to you: How to draw semicircle on Android Canvas.
other than that, would require a bit more of your code to help you out.

Moving elements on a layout controlled programmatically

My goal is to create something like the arrow from car that indicates the speed of the car. My problem is that I do not know what is the best practice for moving the green arrow. I have an image arrow.png and I guess I need to manipulate with the place that the picture is shown and with the rotation of the image.
Can someone point to me some guidelines ?
My basic idea is to have a relative layout for the background and to have one image view that will change the position, but the part changing position is little unclear to me. And I do not think that is good idea to play with layout params and margins...
I would probably extend ImageView then override your onDraw method and use canvas.rotate() to rotate the arrow depending on your app state.

Resources