Computer-readable non-transitory storage medium having stored therein information processing program, information processing system, information processing method, and information processing apparatus

An image of a virtual three-dimensional space in which a three-dimensional object is positioned is displayed. A first straight line is calculated on the basis of predetermined two points in the three-dimensional object, and a second straight line orthogonal to the first straight line is further calculated. Then, either one of the first straight line and the second straight line is selected as a rotation axis on the basis of an input performed with the pointing device, and the three-dimensional object is rotated about the rotation axis.

CROSS REFERENCE TO RELATED APPLICATION

The disclosure of Japanese Patent Application No. 2016-034704, filed on Feb. 25, 2016, is incorporated herein by reference.

FIELD

The exemplary embodiments relate to information processing of operating a three-dimensional object on the basis of an input performed with a pointing device, and more particularly relates to a process of rotating a three-dimensional object displayed on a screen.

BACKGROUND AND SUMMARY

Hitherto, a display processing apparatus for a three-dimensional object is known. Also, a display processing apparatus that uses an operation of a dial type input device in order to rotate or move a displayed three-dimensional object, is known. In such a display processing apparatus, any one of an x axis, a y axis, and a z axis in a virtual three-dimensional space is selected as a rotation axis on the basis of an operation of pressing the dial type input device. Then, the three-dimensional object is rotated about the selected rotation axis on the basis of the rotation direction and the rotation amount of an operation of rotating the dial type input device.

In the above display processing apparatus, in accordance with a single operation of pressing the dial type input device, the x axis, the y axis, and the x axis in the virtual three-dimensional space are switched in a predetermined order, and a rotation axis is selected. Therefore, there is an aspect that it is difficult to perform an intuitive rotation operation. In addition, three axes that can be selected as a rotation axis are axes fixed as an x axis, a y axis and a z axis in a three-dimensional virtual space. Therefore, there is also an aspect that the flexibility in rotation of the three-dimensional object is insufficient.

Therefore, it is an object of the exemplary embodiments to provide an information processing program and the like which enable an intuitive rotation operation regarding an operation of rotating a displayed three-dimensional object, and enable flexible rotation of the three-dimensional object.

In order to attain the object described above, the following configuration examples are exemplified.

A configuration example is directed to a computer-readable non-transitory storage medium having stored therein an information processing program executed by a computer of an information processing apparatus capable of receiving an input performed with a pointing device, the information processing program causing the computer to execute: positioning a three-dimensional object in a virtual three-dimensional space; displaying a three-dimensional image obtained by capturing the virtual three-dimensional space with a virtual camera, on a screen; calculating a first straight line on the basis of predetermined two points in the three-dimensional object; calculating a second straight line orthogonal to the first straight line; selecting either one of the first straight line and the second straight line as a rotation axis on the basis of an input performed with the pointing device; and rotating the three-dimensional object about the selected rotation axis.

According to the above configuration example, regarding an operation for rotating the three-dimensional object, intuitive operability can be provided.

In another configuration example, the information processing program may further cause the computer to execute: calculating a third straight line which is a straight line obtained by projecting the first straight line onto a predetermined plane; and calculating a fourth straight line which is a straight line orthogonal to the third straight line on the predetermined plane. A straight line obtained by translating the fourth straight line from the predetermined plane to the three-dimensional object within the virtual three-dimensional space may be calculated as the second straight line.

According to the above configuration example, the second straight line can be calculated in accordance with the attitude of the three-dimensional object, so that a flexible rotation operation for the three-dimensional object can be provided.

In another configuration example, the information processing program may further cause the computer to execute calculating, on the basis of an input performed with the pointing device, a vector for the input on the predetermined plane, and the calculated vector may be projected to at least one of the third straight line and the fourth straight line, and one of the first straight line and the second straight line may be selected on the basis of a length of the projected vector on the straight line. Further, the calculated vector may be projected to both the third straight line and the fourth straight line, and one of the first straight line and the second straight line may be selected on the basis of the straight line on which the length of the projected vector is shorter. Moreover, when the straight line on which the length of the vector is shorter is the third straight line, the first straight line may be selected, and when the straight line on which the length of the vector is shorter is the fourth straight line, the second straight line may be selected.

According to the above configuration example, in rotating the three-dimensional object, rotation that provides a less feeling of discomfort with respect to the content of an operation of a user can be performed.

In another configuration example, the information processing program may further cause the computer to execute: calculating, on the basis of an input performed with the pointing device, a vector for the input on a predetermined plane; determining whether a length of a straight line obtained by projecting the first straight line onto the predetermined plane is less than a predetermined value; and calculating a fifth straight line which is a straight line orthogonal to a direction of the calculated vector. When it is determined that the length of the projected straight line is less than the predetermined value, a straight line obtained by translating the fifth straight line to the three-dimensional object within the virtual three-dimensional space may be calculated as the second straight line, and the second straight line may be selected as a rotation axis.

According to the above configuration example, operability regarding rotation of the three-dimensional object can be enhanced, and appropriate rotation that provides a less feeling of discomfort with respect to the content of an operation of the user can be performed.

In another configuration example, the predetermined plane may be a display surface or a surface parallel to the display surface, and the pointing device may include a touch panel.

According to the above configuration example, intuitive operability can be provided, and appropriate rotation with respect to the content of an operation can be performed.

In another configuration example, the information processing program may further cause the computer to execute rotating the three-dimensional object about a predetermined one axis in a world coordinate system of the virtual three-dimensional space in accordance with an input performed with the pointing device.

According to the above configuration example, the attitude of the three-dimensional object can be changed more freely, and appropriate rotation corresponding to the attitude at each time can be performed.

In another configuration example, a rotation amount may be calculated on the basis of the input performed with the pointing device, and the three-dimensional object may be rotated in accordance with the rotation amount.

According to the above configuration example, both a rotation axis and a rotation amount for the three-dimensional object can be determined, for example, on the basis of a single swipe operation, so that the operability can be enhanced further.

According to the present embodiment, regarding an operation for rotating the three-dimensional object, more intuitive operability that provides a less feeling of discomfort can be provided.

DETAILED DESCRIPTION OF NON-LIMITING EXAMPLE EMBODIMENTS

Hereinafter, an exemplary embodiment will be described.

In the present embodiment, a portable smart device (hereinafter, referred to merely as smart device) capable of a touch operation, such as a smartphone, is assumed as an example of a display processing apparatus. In the present embodiment, a three-dimensional object is displayed on a screen of the smart device. Then, a process of rotating the three-dimensional object in accordance with an operation (specifically, a swipe operation) on a touch panel is performed.

First, the hardware configuration of the smart device according to the present embodiment will be described.FIG. 1is a functional block diagram of the smart device102. InFIG. 1, the smart device102includes a processor section111, an internal storage device112, a main memory113, an operation section115, and a display section116. The processor section111executes later-described information processing and executes a system program (not shown) for controlling overall operation of the smart device102, thereby controlling operation of the smart device102. The processor section111may include a single processor or a plurality of processors. The internal storage device112stores therein various programs to be executed by the processor section111, and various kinds of data to be used in the programs. The internal storage device112is, for example, a flash EEPROM or a hard disk device. The main memory113temporarily stores therein computer programs and information. The operation section115is, for example, an input device for receiving an operation from a user. The display section116is typically a liquid crystal display unit. In processing according to the present embodiment, a touch panel integrated with a liquid crystal screen is assumed as the operation section115and the display section116. In another embodiment, a predetermined pointing device (e.g., a touch pad, a trackball, etc.) other than a touch panel may be used as the operation section115.

Next, an operation outline of information processing according to the present embodiment will be described.FIG. 2is a diagram showing a screen example of the processing according to the present embodiment. InFIG. 2, a 3D model display area151and a menu display area152are displayed on the display section116. The menu display area152is an area in order for the user to issue various commands for, for example, loading or saving data of a three-dimensional object153or editing the three-dimensional object153. The 3D model display area151is an area for displaying a virtual three-dimensional space image in which the three-dimensional object153is present. In the present embodiment, a human object (avatar object) is shown as an example of the three-dimensional object153. In the present embodiment, a predetermined process with respect to the three-dimensional object153is executed on the basis of a touch operation performed on the 3D model display area151. Specifically, in the present embodiment, in accordance with a swipe operation on the 3D model display area151, the three-dimensional object153can be rotated (hereinafter, a first rotation process).

Here, the principle of the first rotation process according to the present embodiment will be described with reference toFIGS. 3 to 7. First, as shown inFIG. 3, a first straight line201passing through predetermined two points in the three-dimensional object153within the virtual three-dimensional space is calculated. In the example ofFIG. 3, the first straight line201is shown as a straight line connecting the parietal region and the foot (heel) of the three-dimensional object153in the virtual three-dimensional space. The two points are not limited to those in the example ofFIG. 3, and may be any two points.

Next, a second straight line202which is a straight line orthogonal to the first straight line201is calculated. The second straight line202is calculated as follows. First, as shown inFIG. 3, a third straight line203obtained by projecting the first straight line201onto a predetermined plane is calculated. In the present embodiment, the predetermined plane is assumed as a display surface (i.e., a plane corresponding to a display screen). In another embodiment, the predetermined plane may be a surface parallel to the display surface.

Next, as shown inFIG. 4, a fourth straight line204orthogonal to the third straight line203on the display surface is calculated. Then, a straight line obtained by translating the fourth straight line204to the central point of the three-dimensional object153within the virtual three-dimensional space is calculated as the second straight line202. In another embodiment, the fourth straight line204may be translated to a position slightly shifted from the central point of the three-dimensional object153, not exactly to the central point of the three-dimensional object153, or may be translated to an optional position that is not the central point, for example, to the central point of the head of the three-dimensional object153.

Then, in the first rotation process, either the first straight line201or the second straight line202is selected as a rotation axis. Specifically, either the first straight line201or the second straight line202is selected as follows. First, as shown inFIG. 5, a vector210for a swipe operation performed by the user (hereinafter, referred to as a swipe vector) is calculated. Next, the swipe vector210is projected to the third straight line203and the fourth straight line204. As a result of the projection, it is determined which of a component corresponding to the third straight line203and a component corresponding to the fourth straight line204is shorter. Then, of the third straight line203and the fourth straight line204, either one straight line corresponding to the shorter component is selected. In the example ofFIG. 5, the third straight line203is selected.

Next, of the first straight line201and the second straight line202, the straight line corresponding to the selected straight line is selected as a rotation axis. That is, when the straight line selected as a result of the project is the third straight line203, the first straight line201is selected as a rotation axis. In addition, when the straight line selected as a result of the project is the fourth straight line204, the second straight line202is selected as a rotation axis. In the example ofFIG. 5, the first straight line201is selected as a rotation axis.

Then, a process of rotating the three-dimensional object153about the selected rotation axis in accordance with the swipe direction and the swipe distance (swipe amount) of the swipe vector210, is performed.

Meanwhile, it is conceivable that, as shown inFIG. 6, when the attitude of the three-dimensional object153comes close to an attitude in which the three-dimensional object153is orthogonal to the display surface, the first straight line201projected onto the display surface converges to one point. Thus, it is conceivable that it becomes difficult to perform an appropriate rotation process. Therefore, in the present embodiment, in such a case (e.g., when the length of the third straight line203is less than a predetermined value), the following process is performed. First, a straight line orthogonal to the swipe vector210is calculated, and is set as a fifth straight line205. Then, similarly to the case of the fourth straight line, the second straight line202is calculated by translating the fifth straight line205. Then, a process of rotating the three-dimensional object153about the second straight line202is performed (that is, when the length of the third straight line203is less than the predetermined value, the second straight line202is constantly set as a rotation axis).

As described above, in the present embodiment, a process of rotating the three-dimensional object153by using either the first straight line201or the second straight line202as a rotation axis on the basis of a swipe operation, is executed. By the execution of the rotation process as described above, an intuitive rotation operation is made possible. In addition, the first straight line201and the second straight line202change in response to a change in the attitude of the three-dimensional object153(that is, are not fixed), so that it is also made possible to perform a flexible rotation operation. In other words, the first rotation process can be said to be a process of rotating the three-dimensional object153about an axis based on the three-dimensional object153.

The first rotation process can be grasped as the following process. For example, a local coordinate system for the three-dimensional object153in which the first straight line201is a y axis, the second straight line202is an x axis, and an axis orthogonal to these axes is a z axis, is considered. Then, with the y axis fixed, the direction of the z axis is caused to coincide with the depth direction (the z axis direction) in a world coordinate system. Then, the x axis is rotated such that the x axis is orthogonal to the y axis and the z axis, thereby derive a local coordinate system for a rotation process. Then, the three-dimensional object153is rotated about one of the y axis or the x axis in the local coordinate system for a rotation process.

Next, an operation other than the first rotation process will be described. First, by touching the 3D model display area151with two fingers and moving the fingers so as to rotate the fingers in this state, it is possible to rotate the three-dimensional object153about an axis extending in the depth direction when the screen is seen from front (hereinafter, a second rotation process). In the present embodiment, the rotation axis used in the first rotation process and the rotation axis used in the second rotation process are different from each other. In other words, the second rotation process can be said to be a process of rotating the three-dimensional object153about a predetermined one axis in the world coordinate system of the virtual three-dimensional space (the axis in the depth direction in this example). In addition, by touching the three-dimensional object153and performing a drag operation, the three-dimensional object153can be moved. Moreover, the three-dimensional object153can be reduced or enlarged in accordance with a pinch-in or pinch-out operation.

As described above, it is possible to change the display form of the three-dimensional object even by an operation other than a swipe operation. In particular, since it is possible to change the attitude of the three-dimensional object153by a second rotation operation, the above-described process regarding a first rotation operation is effective for making it easy to perform an appropriate operation of rotating the three-dimensional object153.

Next, operation of the processing according to the present embodiment will be described in more detail with reference toFIGS. 8 to 10.

First, data used in the processing according to the present embodiment will be described.FIG. 8shows an example of a program and data stored in the main memory113of the smart device102. A display control program221, operation data222, and 3D model data223, etc. are stored in the main memory113.

The display control program221is a program for executing the rotation processes as described above, and the like. Specifically, the display control program221is a program for executing processing in a flowchart ofFIG. 9described later.

The operation data222is data indicating the contents of various operations performed on the operation section115. In the present embodiment, the operation data222includes data indicating presence/absence of an input to the touch panel as the operation section115, a touch coordinate, and the like.

The 3D model data223is 3D model data for forming the three-dimensional object153.

Next, flow of processing executed by the processor section111of the smart device102will be described with reference to flowchartsFIGS. 10 and 11. A processing loop of steps S2to S9inFIG. 10is executed repeatedly, for example, every 60 frames.

First, when a command for activating an application according to the present embodiment is received, the processor section111executes an initialization process in step S1. Specifically, a process of initializing data used in this processing is executed. Furthermore, the three-dimensional object153is generated on the basis of the 3D model data223, and is positioned within the virtual three-dimensional space. In addition, a virtual camera is also positioned within the virtual three-dimensional space. Then, the processor section111generates an image obtained by capturing the virtual three-dimensional space with the virtual camera, and displays the generated image in the 3D model display area151.

Next, in step S2, the processor section111acquires the operation data222. Subsequently, in step S3, on the basis of the operation data222, the processor section111determines whether a swipe operation has been performed on the 3D model display area151. As a result, when a swipe operation has been performed (YES in step S3), the processor section111calculates the above swipe vector for the swipe operation in step S4. Next, in step S5, the processor section111executes a rotation axis determination process for determining a rotation axis in the first rotation process.

FIG. 10is a flowchart showing details of the rotation axis determination process in step S5. InFIG. 10, first, in step S21, the processor section111executes a process of calculating the first straight line201as described above. For example, a process of calculating a straight line connecting predetermined two points that are predefined for the three-dimensional object153, is executed.

Next, in step S22, the processor section111calculates the third straight line203by projecting the first straight line201onto the display surface.

Next, in step S23, the processor section111determines whether the length of the third straight line203is less than a predetermined value. That is, the processor section111determines how close the first straight line201is to an attitude of being orthogonal to the display surface (seeFIG. 6). As a result of the determination, when the length of the third straight line203is not less than the predetermined value (NO in step S23), the processor section111calculates the fourth straight line204orthogonal to the third straight line203on the display surface in step S24. Subsequently, in step S25, the processor section111calculates, as the second straight line202, a straight line obtained by translating the fourth straight line204to the center of the three-dimensional object153.

Next, in step S26, the processor section111projects the swipe vector to the third straight line203and the fourth straight line204. Then, the processor section111compares the length of the component of the swipe vector on the third straight line that is obtained by the projection and the length of the component of the swipe vector on the fourth straight line that is obtained by the projection. Then, the processor section111selects the straight line corresponding to the component having a shorter length. In the example ofFIG. 5, regarding the swipe vector210, the component on the third straight line203is shorter than the component on the fourth straight line204. Thus, in the case of this drawing, the third straight line203is selected.

As a result of the comparison, when the length of the component of the swipe vector on the third straight line and the length of the component of the swipe vector on the fourth straight line are equal to each other, for example, the straight line that is selected in the processing loop executed last may be selected. Alternatively, when the lengths are equal to each other, either one of the straight lines may be selected fixedly. For example, when the lengths are equal to each other, the third straight line may be selected at every time.

Next, in step S27, the processor section111determines, as a rotation axis, either the first straight line201or the second straight line202corresponding to the selected straight line. When the third straight line203has been selected, the first straight line201is selected. When the fourth straight line204has been selected, the second straight line202is selected. Thereafter, the rotation axis determination process ends.

On the other hand, as a result of the determination in step S23, when the length of the third straight line203is less than the predetermined value (YES in step S23), the processor section111calculates a straight line orthogonal to the swipe vector on the display surface, as the above-described fifth straight line205in step S28.

Next, in step S29, the processor section111calculates, as the second straight line202, a straight line obtained by translating the fifth straight line205to the center of the three-dimensional object153.

Subsequently, in step S30, the processor section111determines the second straight line calculated in step S29, as a rotation axis. Then, the rotation axis determination process ends.

Referring back toFIG. 9, in step S6next to the process in step S5, the processor section111executes a process of rotating the three-dimensional object153about the rotation axis determined in the rotation axis determination process. Specifically, the processor section111calculates the direction and the length (distance) of the swipe operation on the basis of the swipe vector. Then, the processor section111executes a process of rotating the three-dimensional object153about the determined rotation axis by a predetermined amount in accordance with this direction and this length.

On the other hand, as a result of the determination in step S3, when a swipe operation has not been performed (NO in step S3), the processor section111executes, in step S7, a predetermined process based on the content of the operation data222other than the above process. Specifically, when the operation content indicated by the operation data222is a pinch-in or pinch-out operation, the processor section111executes a process of reducing or enlarging the three-dimensional object153(controlling the position or angle of view of the virtual camera) in accordance with the operation content. When the operation content is an operation of touching and dragging the three-dimensional object153(a drag operation being performed while selecting the three-dimensional object153), the processor section111executes a process of moving the currently-selected three-dimensional object153within the virtual three-dimensional space in accordance with the direction and the distance of this drag operation. When the operation content corresponds to the second rotation operation, the processor section111executes a process of rotating the three-dimensional object153about a directional axis in the virtual three-dimensional space corresponding to the depth direction when the display surface is seen from front. That is, the processor section111executes a process of rotating the three-dimensional object153about an axis in the depth direction within the virtual three-dimensional space. When the operation content is an operation on the menu display area152, the processor section111executes a predetermined process based on the touch position at which this operation is performed.

Next, when the process in step S6or S7ends, the processor section111executes, in step S8, a process of rendering, on the screen, an image obtained by capturing, with the virtual camera, the three-dimensional virtual space in which the above process has been reflected.

Next, in step S9, the processor section111determines whether a condition for ending this processing has been met. When the condition has been met (YES in step S9), the processor section111ends the processing. When the condition has not been met (NO in step S9), the processor section111returns to step S2and repeats the above process. This is the end of the detailed description of the display control processing according to the present embodiment.

As described above, in the present embodiment, a rotation process using the first straight line201and the second straight line202is performed as the first rotation process. In other words, a process using two rotation axes is performed in accordance with a swipe operation. In addition, selection of a rotation axis and an amount of rotation about the rotation axis are determined on the basis of a single swipe operation. Thus, an intuitive rotation operation can be provided to the user. Moreover, since the attitudes of the first straight line201and the second straight line202within the virtual space change in accordance with the above operation, flexible rotation of the three-dimensional object153is also possible.

The two points on the basis of which the first straight line201is calculated may be predefined points, or may be freely settable by the user. In addition, in the above example, the “straight lines” such as the first straight line201to the fifth straight line205are calculated. Instead of these “straight lines”, “vectors” may be calculated and processed.

Regarding the process of determining a rotation axis from the first straight line and the second straight line, the swipe vector210is projected to both the third straight line203and the fourth straight line204in the above example. In another embodiment, the swipe vector210may be projected to only either one of the third straight line203and the fourth straight line204. For example, the following process may be performed. The swipe vector210is projected to only the third straight line203. Then, when the length of the projected straight line is less than a predetermined value, the first straight line201is selected as a rotation axis, and when the length is equal to or greater than the predetermined value, the second straight line202is selected as a rotation axis.

In the embodiment described above, the series of processes of the application as described above is performed in the single smart device102. In another embodiment, the series of processes described above may be performed in an information processing system that includes a plurality of information processing apparatuses. For example, in an information processing system that includes a terminal side apparatus and a server side apparatus capable of communicating with the terminal side apparatus via a network, a part of the series of processes may be performed by the server side apparatus. Alternatively, in an information processing system that includes a terminal side apparatus and a server side apparatus capable of communicating with the terminal side apparatus via a network, a main process of the series of the processes may be performed by the server side apparatus, and a part of the series of the processes may be performed by the terminal side apparatus. Still alternatively, in the information processing system, a server side system may include a plurality of information processing apparatuses, and a process to be performed in the server side system may be divided and performed by the plurality of information processing apparatuses.