I have a bow and arrow. The arrow needs to look like it's on the bow and move with the bow until the arrow get shot forward. So how do I make an object always stay with the bow and move as the bow does, in other words temporarily combining the two? I'm currently using SceneKit. Thanks
the easiest way is to make the arrow a child node of the bow. Or you can have a look at SCNTransformConstraint.
Related
I'm trying to build a game that uses a concept from the known game "The Sims". Right now I'm building the AI for a 3d Character, and I need the player to be able to tell where the character should go or do. I want to know the best ways to create a pop up menu with animations, kind of to show some choices, so that when the player clicks over the 3d Character he can pick wherever he wants to do. I know this must be using UI elements under a Canvas that's placed over the player. However I can not have 2 Canvas in a Scene and I don't know how to fix them to the character so that it moves with him. Thanks in advance.
Here you can see what I mean, this is the Sims Game
You have two main approaches here:
1) Use a world space UI.
2) Use a screen space UI and position it in real time using a worldspace to screen space transformation.
Both of these topics will expand substantially when you approach them, so it's not possible to give any more specifics from here.
Having played the Sims a bit before though, I would suggest you use a world space UI system if you're chasing the same style as them.
You can have as many canvases as you want. To control levels of canvases (which one is on top) you use "Order in Layer" parameter in "Canvas" component of your chosen Canvas. The lower the number is the higher interactivity and visibility your canvas has.
You can create one canvas ant parent it to you character. AS the canvas will be smaller your should play with these parameters to get the resolution you want (don't over do it):
To make canvas always facing the camera you should give Canvas a new script, with a command:
canvas.transform.LookAt(camera.transform);
To control canvas' visibility you may use this code line:
canvas.enabled = bool;
Where bool is false when you want to hide it and bool is true when you want to show it.
In the "Sims" the visibility comes with animation which you may do also, but I would leave it after I did all the functionality.
I am trying to create a knowledge template, such that when I choose a string value from a dropdown list of a multiple value parameter, the reaction fires according to the selection. For example, if I select "no cut", no pocket features are created. (or deleted if they already exist) If I select "top cut", a predefined sketch is used to drive the pocket feature. However, where I'm stuck, is that I want to define a "bottom cut" by changing the orientation of a positioned sketch. I envision it like this:
"bottom cut" selected from drop down list
change sketch support would be initiated
"Reverse V" would be
selected
sketch would be flipped around the xy plane
If "both top and bottom cut" is selected, it would return the sketch to top position (uncheck "Reverse V") and mirror the resultant pocket around XY
I have managed to accomplish everything but the "Reverse V" of "Change Sketch Support". No idea at all what is the best way to accomplish this.
So far, I've created both Knowledgeware actions, and VB actions. Open to any and all suggestions on this one.
Thank you.
Regarding that API for flipping objects orientation are not available, I suggest that you base your sketch orientation on a feature that can be easily flipped:
Create a line based on two "coordinates" points
Use positioned sketch and specify the support plane, the origin point, and orientation for the V direction by using the previously created line
You can now control the points coordinates to change the orientation of the line, and the sketch will follow.
The code will be simple, and the solution is very stable.
Assuming that the reference line is based on two points {0,0,0} and {x,0,0}, the code would be
if TopOrientation
{
GeoSet1\RefPoint\X=1mm
}
else
{
GeoSet1\RefPoint\X=-1mm
}
I hope it will help you.
I was wondering if someone could teach me how to make a scene in flash where you have an image on top of the other, and you can scratch the top one off to show what's below.
Kinda like those prize cards where you have to scratch the silver thing to see if there's a prize below.
Anyone has any idea if this is even possible in flash?
Yes it's possible, here is one example. I'm sure there are others.
The concept is that you use a mask to hide the image. Then use a mouse move event listener to draw on the mask as the user mouses over the object. Parts of the mask that have something on them (ie: the stuff you're drawing in the mouse move listener) will then reveal the underlying object that was being masked.
Hi I'm looking to do the following:
For a game, Create some effects based on the current view.
The code needs to grab part of a view then manipulate it.
One I need is "glass", so when the character walks behind the glass(or where the glass should be), the code will grab the image behind the glass and stretch it and reprint it where the glass should be, to give the effect of walking behind a lens.
What is the best way to do this?
I've never tried any thing like this before, so any help will be great!
I think you're asking about the image manipulation capabilities of the cocoa framework, in which case I reccomend looking into CoreImage:
http://developer.apple.com/library/mac/#documentation/graphicsimaging/Conceptual/CoreImaging/ci_intro/ci_intro.html#//apple_ref/doc/uid/TP30001185
The NSBox draws on top of the player view, the resulting composition gets a CIFilter (distortion) applied to it before drawing.
I have an NSMutableArray of jpg images and I want to be able to touch and, moving my finger from right to left, move through the array of images in order. I've been reading about UIScrollView, but I'm not sure if this accomplishes what I am looking for. It seems to me that UIScrollView is more used for viewing an object that is too large to be displayed entirely on the screen and you need to be able to move to see every part of the object. I need to move to an entirely new image, the next image in my array. What is the best way to go about this?
You certainly can use a UIScrollView for what you want. A scroll view can be used, as you noted, to scroll an area that is too large for the screen. However, you can also use it to scroll through "pages". This is really the best way to do what you want, short of rolling your won scroll view.
There is a property of UIScrollView, called pagingEnabled, which you'll want to set to YES. I suggest that you give it a try. Also, have a look at the UIScrollView documentation and the Scroll View programming guide. It will tell you all that you need to know about UIScrollViews. Also, remember that for proper memory management, you'll want to only load three images at any given time. See this answer that I wrote for more information on that, and on UIScrollViews in general.